testcases: use Test::More is_deeply, don't depend on Test::Deep
This commit is contained in:
parent
3a9d94bba4
commit
8d83697cc2
|
@ -10,8 +10,6 @@ WriteMakefile(
|
||||||
'AnyEvent' => 0,
|
'AnyEvent' => 0,
|
||||||
'AnyEvent::I3' => '0.09',
|
'AnyEvent::I3' => '0.09',
|
||||||
'X11::XCB' => '0.03',
|
'X11::XCB' => '0.03',
|
||||||
'Test::Most' => 0,
|
|
||||||
'Test::Deep' => 0,
|
|
||||||
'EV' => 0,
|
'EV' => 0,
|
||||||
'Inline' => 0,
|
'Inline' => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -61,15 +61,14 @@ sub import {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $pkg = caller;
|
my $pkg = caller;
|
||||||
|
|
||||||
my $test_most_args = @_ ? "qw(@_)" : "";
|
my $test_more_args = @_ ? "qw(@_)" : "";
|
||||||
local $@;
|
local $@;
|
||||||
eval << "__";
|
eval << "__";
|
||||||
package $pkg;
|
package $pkg;
|
||||||
use Test::Most $test_most_args;
|
use Test::More $test_more_args;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use AnyEvent::I3;
|
use AnyEvent::I3;
|
||||||
use Time::HiRes qw(sleep);
|
use Time::HiRes qw(sleep);
|
||||||
use Test::Deep qw(eq_deeply cmp_deeply);
|
|
||||||
__
|
__
|
||||||
$tester->bail_out("$@") if $@;
|
$tester->bail_out("$@") if $@;
|
||||||
feature->import(":5.10");
|
feature->import(":5.10");
|
||||||
|
|
|
@ -21,6 +21,6 @@ $window->map;
|
||||||
sleep(0.25);
|
sleep(0.25);
|
||||||
|
|
||||||
my $new_rect = $window->rect;
|
my $new_rect = $window->rect;
|
||||||
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
|
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
|
@ -51,7 +51,7 @@ wait_for_map $window;
|
||||||
cmd 'open';
|
cmd 'open';
|
||||||
|
|
||||||
my $new_rect = $window->rect;
|
my $new_rect = $window->rect;
|
||||||
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
|
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
|
||||||
$original_rect = $new_rect;
|
$original_rect = $new_rect;
|
||||||
|
|
||||||
$window->fullscreen(1);
|
$window->fullscreen(1);
|
||||||
|
@ -59,7 +59,7 @@ $window->fullscreen(1);
|
||||||
sync_with_i3;
|
sync_with_i3;
|
||||||
|
|
||||||
$new_rect = $window->rect;
|
$new_rect = $window->rect;
|
||||||
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
|
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
|
||||||
|
|
||||||
my $orect = $output->{rect};
|
my $orect = $output->{rect};
|
||||||
my $wrect = $new_rect;
|
my $wrect = $new_rect;
|
||||||
|
@ -98,7 +98,7 @@ $window->map;
|
||||||
wait_for_map $window;
|
wait_for_map $window;
|
||||||
|
|
||||||
$new_rect = $window->rect;
|
$new_rect = $window->rect;
|
||||||
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
|
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
|
||||||
ok($window->mapped, "Window is mapped after opening it in fullscreen mode");
|
ok($window->mapped, "Window is mapped after opening it in fullscreen mode");
|
||||||
|
|
||||||
$wrect = $new_rect;
|
$wrect = $new_rect;
|
||||||
|
@ -128,7 +128,7 @@ sync_with_i3;
|
||||||
ok(!$swindow->mapped, 'window not mapped while fullscreen window active');
|
ok(!$swindow->mapped, 'window not mapped while fullscreen window active');
|
||||||
|
|
||||||
$new_rect = $swindow->rect;
|
$new_rect = $swindow->rect;
|
||||||
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
|
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
|
||||||
|
|
||||||
$swindow->fullscreen(1);
|
$swindow->fullscreen(1);
|
||||||
sync_with_i3;
|
sync_with_i3;
|
||||||
|
|
|
@ -50,7 +50,7 @@ my $expected = {
|
||||||
'floating_nodes' => ignore(),
|
'floating_nodes' => ignore(),
|
||||||
};
|
};
|
||||||
|
|
||||||
cmp_deeply($tree, $expected, 'root node OK');
|
is_deeply($tree, $expected, 'root node OK');
|
||||||
|
|
||||||
my @nodes = @{$tree->{nodes}};
|
my @nodes = @{$tree->{nodes}};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ sub check_order {
|
||||||
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
|
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
|
||||||
my @sorted = sort @nums;
|
my @sorted = sort @nums;
|
||||||
|
|
||||||
cmp_deeply(\@nums, \@sorted, $msg);
|
is_deeply(\@nums, \@sorted, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_order('workspace order alright before testing');
|
check_order('workspace order alright before testing');
|
||||||
|
|
|
@ -13,7 +13,7 @@ sub check_order {
|
||||||
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
|
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
|
||||||
my @sorted = sort @nums;
|
my @sorted = sort @nums;
|
||||||
|
|
||||||
cmp_deeply(\@nums, \@sorted, $msg);
|
is_deeply(\@nums, \@sorted, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
|
@ -18,7 +18,7 @@ EOT
|
||||||
my $pid = launch_with_config($config);
|
my $pid = launch_with_config($config);
|
||||||
|
|
||||||
my @names = @{get_workspace_names()};
|
my @names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
|
is_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ EOT
|
||||||
$pid = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
@names = @{get_workspace_names()};
|
@names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ EOT
|
||||||
$pid = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
@names = @{get_workspace_names()};
|
@names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ sub get_marks {
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
my $marks = get_marks();
|
my $marks = get_marks();
|
||||||
cmp_deeply($marks, [], 'no marks set so far');
|
is_deeply($marks, [], 'no marks set so far');
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 2: check that setting a mark is reflected in the get_marks reply
|
# 2: check that setting a mark is reflected in the get_marks reply
|
||||||
|
@ -25,7 +25,7 @@ cmp_deeply($marks, [], 'no marks set so far');
|
||||||
cmd 'open';
|
cmd 'open';
|
||||||
cmd 'mark foo';
|
cmd 'mark foo';
|
||||||
|
|
||||||
cmp_deeply(get_marks(), [ 'foo' ], 'mark foo set');
|
is_deeply(get_marks(), [ 'foo' ], 'mark foo set');
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 3: check that the mark is gone after killing the container
|
# 3: check that the mark is gone after killing the container
|
||||||
|
@ -33,7 +33,7 @@ cmp_deeply(get_marks(), [ 'foo' ], 'mark foo set');
|
||||||
|
|
||||||
cmd 'kill';
|
cmd 'kill';
|
||||||
|
|
||||||
cmp_deeply(get_marks(), [ ], 'mark gone');
|
is_deeply(get_marks(), [ ], 'mark gone');
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# 4: check that duplicate marks are included twice in the get_marks reply
|
# 4: check that duplicate marks are included twice in the get_marks reply
|
||||||
|
@ -45,6 +45,6 @@ cmd 'mark bar';
|
||||||
cmd 'open';
|
cmd 'open';
|
||||||
cmd 'mark bar';
|
cmd 'mark bar';
|
||||||
|
|
||||||
cmp_deeply(get_marks(), [ 'bar', 'bar' ], 'duplicate mark found twice');
|
is_deeply(get_marks(), [ 'bar', 'bar' ], 'duplicate mark found twice');
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue