]> git.sur5r.net Git - i3/i3/blob - testcases/t/20-multiple-cmds.t
Merge branch 'fix-i3bar-man'
[i3/i3] / testcases / t / 20-multiple-cmds.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Tests multiple commands (using ';') and multiple operations (using ',')
5 #
6 use i3test;
7
8 my $tmp = fresh_workspace;
9
10 sub multiple_cmds {
11     my ($cmd) = @_;
12
13     cmd 'open';
14     cmd 'open';
15     ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
16
17     cmd $cmd;
18     ok(@{get_ws_content($tmp)} == 0, "both containers killed (cmd = $cmd)");
19 }
20 multiple_cmds('kill;kill');
21 multiple_cmds('kill; kill');
22 multiple_cmds('kill ; kill');
23 multiple_cmds('kill ;kill');
24 multiple_cmds('kill  ;kill');
25 multiple_cmds('kill  ;  kill');
26 multiple_cmds("kill;\tkill");
27 multiple_cmds("kill\t;kill");
28 multiple_cmds("kill\t;\tkill");
29 multiple_cmds("kill\t ;\tkill");
30 multiple_cmds("kill\t ;\t kill");
31 multiple_cmds("kill \t ; \t kill");
32
33 #####################################################################
34 # test if un-quoted strings are handled correctly
35 #####################################################################
36
37 $tmp = fresh_workspace;
38 cmd 'open';
39 my $unused = get_unused_workspace;
40 ok(!($unused ~~ @{get_workspace_names()}), 'workspace does not exist yet');
41 cmd "move workspace $unused; nop parser test";
42 ok(($unused ~~ @{get_workspace_names()}), 'workspace exists after moving');
43
44 #####################################################################
45 # quote the workspace name and use a ; (command separator) in its name
46 #####################################################################
47
48 $unused = get_unused_workspace;
49 $unused .= ';a';
50 ok(!($unused ~~ @{get_workspace_names()}), 'workspace does not exist yet');
51 cmd qq|move workspace "$unused"; nop parser test|;
52 ok(($unused ~~ @{get_workspace_names()}), 'workspace exists after moving');
53
54 # TODO: need a non-invasive command before implementing a test which uses ','
55
56 done_testing;