3 use base 'Test::Builder::Module';
5 our @EXPORT = qw(is_num_children);
7 my $CLASS = __PACKAGE__;
11 i3test::Test - Additional test instructions for use in i3 testcases
17 my $ws = fresh_workspace;
18 is_num_children($ws, 0, 'no containers on this workspace yet');
20 is_num_children($ws, 1, 'one container after "open"');
26 This module provides convenience methods for i3 testcases. If you notice that a
27 certain pattern is present in 5 or more test cases, it should most likely be
28 moved into this module.
32 =head2 is_num_children($workspace, $expected, $test_name)
34 Gets the number of children on the given workspace and verifies that they match
35 the expected amount of children.
37 is_num_children('1', 0, 'no containers on workspace 1 at startup');
42 my ($workspace, $num_children, $name) = @_;
43 my $tb = $CLASS->builder;
45 my $con = i3test::get_ws($workspace);
46 $tb->ok(defined($con), "Workspace $workspace exists");
48 $tb->skip("Workspace does not exist, skipping is_num_children");
52 my $got_num_children = scalar @{$con->{nodes}};
54 $tb->is_num($got_num_children, $num_children, $name);
59 Michael Stapelberg <michael@i3wm.org>