use i3test tests => 1;
use X11::XCB qw(:all);
-my $i3 = i3("/tmp/nestedcons");
-
my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
-
-$i3->command('open')->recv;
-$i3->command('mode toggle')->recv;
-$i3->command('kill')->recv;
-$i3->command('kill')->recv;
+cmd "workspace $tmp";
+cmd 'open';
+cmd 'mode toggle';
+cmd 'kill';
+cmd 'kill';
-my $tree = $i3->get_tree->recv;
-my @nodes = @{$tree->{nodes}};
-ok(@nodes > 0, 'i3 still lives');
+does_i3_live;
diag( "Testing i3, Perl $], $^X" );
sleep 1;
$i3->command('mode toggle')->recv;
-my $tree = $i3->get_tree->recv;
-my @nodes = @{$tree->{nodes}};
-ok(@nodes > 0, 'i3 still lives');
+does_i3_live;
diag( "Testing i3, Perl $], $^X" );
#
use i3test tests => 1;
-my $i3 = i3("/tmp/nestedcons");
+cmd 'blargh!';
-$i3->command("blargh!")->recv;
-
-my $tree = $i3->get_tree->recv;
-my @nodes = @{$tree->{nodes}};
-ok(@nodes > 0, 'i3 still lives');
+does_i3_live;
diag( "Testing i3, Perl $], $^X" );
cmd 'mode toggle';
cmd "move workspace $otmp";
-my $tree = i3('/tmp/nestedcons')->get_tree->recv;
-my @nodes = @{$tree->{nodes}};
-ok(@nodes > 0, 'i3 still lives');
+does_i3_live;
cmd 'move before v';
sleep 0.25;
-my $tree = i3('/tmp/nestedcons')->get_tree->recv;
-my @nodes = @{$tree->{nodes}};
-ok(@nodes > 0, 'i3 still lives');
+does_i3_live;