2 # vim:ts=4:sw=4:expandtab
4 # Tests whether opening an empty container and killing it again works
6 use List::Util qw(first);
9 my $tmp = fresh_workspace;
11 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
13 # Open a new container
16 ok(@{get_ws_content($tmp)} == 1, 'container opened');
19 ok(@{get_ws_content($tmp)} == 0, 'container killed');
21 ##############################################################
22 # open two containers and kill the one which is not focused
23 # by its ID to test if the parser correctly matches the window
24 ##############################################################
28 ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
30 my $content = get_ws_content($tmp);
31 my $not_focused = first { !$_->{focused} } @{$content};
32 my $id = $not_focused->{id};
34 cmd "[con_id=\"$id\"] kill";
36 $content = get_ws_content($tmp);
37 ok(@{$content} == 1, 'one container killed');
38 ok($content->[0]->{id} != $id, 'correct window killed');