2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Tests multiple commands (using ';') and multiple operations (using ',')
21 my $tmp = fresh_workspace;
28 ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
31 ok(@{get_ws_content($tmp)} == 0, "both containers killed (cmd = $cmd)");
33 multiple_cmds('kill;kill');
34 multiple_cmds('kill; kill');
35 multiple_cmds('kill ; kill');
36 multiple_cmds('kill ;kill');
37 multiple_cmds('kill ;kill');
38 multiple_cmds('kill ; kill');
39 multiple_cmds("kill;\tkill");
40 multiple_cmds("kill\t;kill");
41 multiple_cmds("kill\t;\tkill");
42 multiple_cmds("kill\t ;\tkill");
43 multiple_cmds("kill\t ;\t kill");
44 multiple_cmds("kill \t ; \t kill");
46 #####################################################################
47 # test if un-quoted strings are handled correctly
48 #####################################################################
50 $tmp = fresh_workspace;
52 my $unused = get_unused_workspace;
53 ok(!($unused ~~ @{get_workspace_names()}), 'workspace does not exist yet');
54 cmd "move workspace $unused; nop parser test";
55 ok(($unused ~~ @{get_workspace_names()}), 'workspace exists after moving');
57 #####################################################################
58 # quote the workspace name and use a ; (command separator) in its name
59 #####################################################################
62 $unused = get_unused_workspace;
64 ok(!($unused ~~ @{get_workspace_names()}), 'workspace does not exist yet');
65 cmd qq|move workspace "$unused"; nop parser test|;
66 ok(($unused ~~ @{get_workspace_names()}), 'workspace exists after moving');
68 # TODO: need a non-invasive command before implementing a test which uses ','
70 ################################################################################
71 # regression test: 10 invalid commands should not crash i3 (10 is the stack
73 ################################################################################
75 cmd 'move gibberish' for (0 .. 10);
79 ################################################################################
80 # regression test: an invalid command should come back with an error.
81 ################################################################################
83 my $reply = cmd 'bullshit-command-which-we-never-implement meh';
84 is(scalar @$reply, 1, 'got one command reply');
85 ok(!$reply->[0]->{success}, 'reply has success == false');