testcases: correctly enable lexical pragmata
eval 'package foo; use strict;' enables strict within eval, it does not leak into the surrounding scope. Also fix various warnings/compile errors found due to now enabled strict and warnings.
This commit is contained in:
parent
0a65b770e8
commit
1b1d7941ec
|
@ -66,11 +66,11 @@ use Data::Dumper;
|
|||
use AnyEvent::I3;
|
||||
use Time::HiRes qw(sleep);
|
||||
use Test::Deep qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods useclass noclass set bag subbagof superbagof subsetof supersetof superhashof subhashof bool str arraylength Isa ignore methods regexprefonly regexpmatches num regexponly scalref reftype hashkeysonly blessed array re hash regexpref hash_each shallow array_each code arrayelementsonly arraylengthonly scalarrefonly listmethods any hashkeys isa);
|
||||
use v5.10;
|
||||
use strict;
|
||||
use warnings;
|
||||
__
|
||||
$tester->bail_out("$@") if $@;
|
||||
feature->import(":5.10");
|
||||
strict->import;
|
||||
warnings->import;
|
||||
|
||||
@_ = ($class);
|
||||
goto \&Exporter::import;
|
||||
|
|
|
@ -31,7 +31,7 @@ sub focus_after {
|
|||
return $x->input_focus;
|
||||
}
|
||||
|
||||
$focus = $x->input_focus;
|
||||
my $focus = $x->input_focus;
|
||||
is($focus, $bottom->id, "Latest window focused");
|
||||
|
||||
$focus = focus_after('focus up');
|
||||
|
|
|
@ -88,7 +88,7 @@ $window = open_window($x, {
|
|||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
||||
});
|
||||
|
||||
my $rect = $window->rect;
|
||||
$rect = $window->rect;
|
||||
is($rect->width, $primary->rect->width, 'dock client is as wide as the screen');
|
||||
is($rect->height, 30, 'height is unchanged');
|
||||
|
||||
|
@ -153,8 +153,8 @@ $window = open_window($x, {
|
|||
$window->_create();
|
||||
|
||||
# Add a _NET_WM_STRUT_PARTIAL hint
|
||||
my $atomname = $x->atom(name => '_NET_WM_STRUT_PARTIAL');
|
||||
my $atomtype = $x->atom(name => 'CARDINAL');
|
||||
$atomname = $x->atom(name => '_NET_WM_STRUT_PARTIAL');
|
||||
$atomtype = $x->atom(name => 'CARDINAL');
|
||||
|
||||
$x->change_property(
|
||||
PROP_MODE_REPLACE,
|
||||
|
@ -180,7 +180,7 @@ $window->destroy;
|
|||
# regression test: transient dock client
|
||||
#####################################################################
|
||||
|
||||
$fwindow = open_window($x, {
|
||||
my $fwindow = open_window($x, {
|
||||
dont_map => 1,
|
||||
background_color => '#FF0000',
|
||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
||||
|
|
|
@ -48,7 +48,7 @@ sub focus_after {
|
|||
return $x->input_focus;
|
||||
}
|
||||
|
||||
$focus = $x->input_focus;
|
||||
my $focus = $x->input_focus;
|
||||
is($focus, $bottom->id, "Latest window focused");
|
||||
|
||||
$focus = focus_after("ml");
|
||||
|
|
|
@ -46,7 +46,7 @@ sub focus_after {
|
|||
return $x->input_focus;
|
||||
}
|
||||
|
||||
$focus = $x->input_focus;
|
||||
my $focus = $x->input_focus;
|
||||
is($focus, $bottom->id, "Latest window focused");
|
||||
|
||||
$focus = focus_after("s");
|
||||
|
|
|
@ -30,7 +30,7 @@ sub focus_after {
|
|||
return $x->input_focus;
|
||||
}
|
||||
|
||||
$focus = $x->input_focus;
|
||||
my $focus = $x->input_focus;
|
||||
is($focus, $bottom->id, "Latest window focused");
|
||||
|
||||
$focus = focus_after('focus left');
|
||||
|
|
|
@ -33,10 +33,10 @@ is(@urgent, 0, 'no window got the urgent flag');
|
|||
$top->add_hint('urgency');
|
||||
sync_with_i3($x);
|
||||
|
||||
@content = @{get_ws_content($tmp)};
|
||||
my @content = @{get_ws_content($tmp)};
|
||||
@urgent = grep { $_->{urgent} } @content;
|
||||
$top_info = first { $_->{window} == $top->id } @content;
|
||||
$bottom_info = first { $_->{window} == $bottom->id } @content;
|
||||
my $top_info = first { $_->{window} == $top->id } @content;
|
||||
my $bottom_info = first { $_->{window} == $bottom->id } @content;
|
||||
|
||||
ok($top_info->{urgent}, 'top window is marked urgent');
|
||||
ok(!$bottom_info->{urgent}, 'bottom window is not marked urgent');
|
||||
|
|
|
@ -108,7 +108,7 @@ ok(defined($ws), "workspace 3: $tmp was created");
|
|||
is($ws->{num}, 3, 'workspace number is 3');
|
||||
|
||||
cmd "workspace 0: $tmp";
|
||||
my $ws = get_ws("0: $tmp");
|
||||
$ws = get_ws("0: $tmp");
|
||||
ok(defined($ws), "workspace 0: $tmp was created");
|
||||
is($ws->{num}, 0, 'workspace number is 0');
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ isnt($first, $second, 'different container focused');
|
|||
|
||||
cmd qq|[con_id="$first"] focus|;
|
||||
cmd 'open';
|
||||
$content = get_ws_content($tmp);
|
||||
my $content = get_ws_content($tmp);
|
||||
ok(@{$content} == 3, 'three containers opened');
|
||||
|
||||
is($content->[0]->{id}, $first, 'first container unmodified');
|
||||
|
|
|
@ -17,7 +17,7 @@ cmd qq|[con_id="$first"] focus|;
|
|||
|
||||
cmd 'split v';
|
||||
|
||||
($nodes, $focus) = get_ws_content($tmp);
|
||||
my ($nodes, $focus) = get_ws_content($tmp);
|
||||
|
||||
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
||||
|
||||
|
@ -27,7 +27,7 @@ cmd 'level up';
|
|||
my $split = $focus->[0];
|
||||
cmd 'level down';
|
||||
|
||||
my $second = open_empty_con($i3);
|
||||
$second = open_empty_con($i3);
|
||||
|
||||
isnt($first, $second, 'different container focused');
|
||||
|
||||
|
@ -62,10 +62,10 @@ is($nodes->[0]->{focused}, 0, 'split container not focused');
|
|||
# focus the split container
|
||||
cmd 'level up';
|
||||
($nodes, $focus) = get_ws_content($tmp);
|
||||
my $split = $focus->[0];
|
||||
$split = $focus->[0];
|
||||
cmd 'level down';
|
||||
|
||||
my $second = open_empty_con($i3);
|
||||
$second = open_empty_con($i3);
|
||||
|
||||
isnt($first, $second, 'different container focused');
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ $tmp = fresh_workspace;
|
|||
|
||||
$first = open_window($x, { background_color => '#ff0000' }); # window 5
|
||||
$second = open_window($x, { background_color => '#00ff00' }); # window 6
|
||||
my $third = open_window($x, { background_color => '#0000ff' }); # window 7
|
||||
$third = open_window($x, { background_color => '#0000ff' }); # window 7
|
||||
|
||||
is($x->input_focus, $third->id, 'last container focused');
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
|
|||
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
||||
|
||||
# Create a floating window
|
||||
my $window = open_floating_window($x);
|
||||
$window = open_floating_window($x);
|
||||
ok($window->mapped, 'Window is mapped');
|
||||
|
||||
$ws = get_ws($tmp);
|
||||
|
|
|
@ -37,7 +37,7 @@ is(@{$nodes->[1]->{nodes}}, 2, 'two windows in split con');
|
|||
|
||||
cmd 'floating toggle';
|
||||
|
||||
my ($nodes, $focus) = get_ws_content($tmp);
|
||||
($nodes, $focus) = get_ws_content($tmp);
|
||||
|
||||
is(@{$nodes->[1]->{nodes}}, 3, 'three windows in split con after floating toggle');
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen');
|
|||
cmd 'nop making fullscreen';
|
||||
cmd 'fullscreen';
|
||||
|
||||
my $nodes = get_ws_content $tmp;
|
||||
$nodes = get_ws_content $tmp;
|
||||
is($nodes->[0]->{fullscreen_mode}, 1, 'client fullscreen now');
|
||||
|
||||
#####################################################################
|
||||
|
@ -40,7 +40,7 @@ is($nodes->[0]->{fullscreen_mode}, 1, 'client fullscreen now');
|
|||
cmd 'level up';
|
||||
cmd 'fullscreen';
|
||||
|
||||
my $nodes = get_ws_content $tmp;
|
||||
$nodes = get_ws_content $tmp;
|
||||
is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen any longer');
|
||||
|
||||
does_i3_live;
|
||||
|
|
|
@ -42,7 +42,7 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
|
|||
# 'kill window'
|
||||
##############################################################
|
||||
|
||||
my $tmp = two_windows;
|
||||
$tmp = two_windows;
|
||||
|
||||
cmd 'kill window';
|
||||
|
||||
|
@ -55,7 +55,7 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
|
|||
# and check if both are gone
|
||||
##############################################################
|
||||
|
||||
my $tmp = two_windows;
|
||||
$tmp = two_windows;
|
||||
|
||||
cmd 'kill client';
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ is($content[0]->{border}, 'normal', 'normal border');
|
|||
$window->unmap;
|
||||
wait_for_unmap $x;
|
||||
|
||||
my @content = @{get_ws_content($tmp)};
|
||||
@content = @{get_ws_content($tmp)};
|
||||
cmp_ok(@content, '==', 0, 'no more nodes');
|
||||
diag('content = '. Dumper(\@content));
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
|||
my $workspaces = get_workspace_names;
|
||||
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||
|
||||
my $window = $x->root->create_child(
|
||||
$window = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30 ],
|
||||
background_color => '#0000ff',
|
||||
|
@ -124,7 +124,7 @@ $tmp = fresh_workspace;
|
|||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||
ok("targetws" ~~ @{get_workspace_names()}, 'targetws does not exist yet');
|
||||
|
||||
my $window = $x->root->create_child(
|
||||
$window = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30 ],
|
||||
background_color => '#0000ff',
|
||||
|
@ -162,10 +162,10 @@ $pid = launch_with_config($config);
|
|||
$tmp = fresh_workspace;
|
||||
|
||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||
my $workspaces = get_workspace_names;
|
||||
$workspaces = get_workspace_names;
|
||||
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||
|
||||
my $window = $x->root->create_child(
|
||||
$window = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30 ],
|
||||
background_color => '#0000ff',
|
||||
|
@ -203,10 +203,10 @@ $pid = launch_with_config($config);
|
|||
$tmp = fresh_workspace;
|
||||
|
||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||
my $workspaces = get_workspace_names;
|
||||
$workspaces = get_workspace_names;
|
||||
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||
|
||||
my $window = $x->root->create_child(
|
||||
$window = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30 ],
|
||||
background_color => '#0000ff',
|
||||
|
@ -219,7 +219,7 @@ $window->name('special window');
|
|||
$window->map;
|
||||
wait_for_map $x;
|
||||
|
||||
my $content = get_ws($tmp);
|
||||
$content = get_ws($tmp);
|
||||
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
||||
ok(@{$content->{floating_nodes}} == 1, 'one floating con');
|
||||
|
||||
|
@ -255,7 +255,7 @@ my @docked = get_dock_clients;
|
|||
# syntax
|
||||
is(@docked, 1, 'one dock client yet');
|
||||
|
||||
my $window = $x->root->create_child(
|
||||
$window = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
rect => [ 0, 0, 30, 30 ],
|
||||
background_color => '#0000ff',
|
||||
|
@ -269,7 +269,7 @@ $window->name('special window');
|
|||
$window->map;
|
||||
wait_for_map $x;
|
||||
|
||||
my $content = get_ws($tmp);
|
||||
$content = get_ws($tmp);
|
||||
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
||||
ok(@{$content->{floating_nodes}} == 0, 'one floating con');
|
||||
@docked = get_dock_clients;
|
||||
|
|
|
@ -33,7 +33,8 @@ my $second = open_window($x);
|
|||
sync_with_i3($x);
|
||||
|
||||
is($x->input_focus, $second->id, 'second window focused');
|
||||
ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
|
||||
my @content = @{get_ws_content($tmp)};
|
||||
ok(@content == 2, 'two containers opened');
|
||||
isnt($content[0]->{layout}, 'stacked', 'layout not stacked');
|
||||
isnt($content[1]->{layout}, 'stacked', 'layout not stacked');
|
||||
|
||||
|
@ -62,7 +63,7 @@ $second = open_window($x);
|
|||
sync_with_i3($x);
|
||||
|
||||
is($x->input_focus, $second->id, 'second window focused');
|
||||
my @content = @{get_ws_content($tmp)};
|
||||
@content = @{get_ws_content($tmp)};
|
||||
ok(@content == 1, 'one con at workspace level');
|
||||
is($content[0]->{layout}, 'stacked', 'layout stacked');
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ EOT
|
|||
|
||||
$pid = launch_with_config($config);
|
||||
|
||||
my @names = @{get_workspace_names()};
|
||||
@names = @{get_workspace_names()};
|
||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||
|
||||
exit_gracefully($pid);
|
||||
|
@ -57,7 +57,7 @@ EOT
|
|||
|
||||
$pid = launch_with_config($config);
|
||||
|
||||
my @names = @{get_workspace_names()};
|
||||
@names = @{get_workspace_names()};
|
||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||
|
||||
exit_gracefully($pid);
|
||||
|
|
Loading…
Reference in New Issue