]> git.sur5r.net Git - i3/i3/blob - testcases/t/17-workspace.t
testcases: remove 'use v5.10' as this is automatically done in lib/i3test
[i3/i3] / testcases / t / 17-workspace.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Tests whether we can switch to a non-existant workspace
5 # (necessary for further tests)
6 #
7 use i3test tests => 3;
8
9 my $i3 = i3("/tmp/nestedcons");
10
11 sub workspace_exists {
12     my ($name) = @_;
13     ($name ~~ @{get_workspace_names()})
14 }
15
16 my $tmp = get_unused_workspace();
17 diag("Temporary workspace name: $tmp\n");
18
19 $i3->command("workspace $tmp")->recv;
20 ok(workspace_exists($tmp), 'workspace created');
21 # if the workspace could not be created, we cannot run any other test
22 # (every test starts by creating its workspace)
23 if (!workspace_exists($tmp)) {
24     BAIL_OUT('Cannot create workspace, further tests make no sense');
25 }
26
27 my $otmp = get_unused_workspace();
28 diag("Other temporary workspace name: $otmp\n");
29
30 # As the old workspace was empty, it should get
31 # cleaned up as we switch away from it
32 $i3->command("workspace $otmp")->recv;
33 ok(!workspace_exists($tmp), 'old workspace cleaned up');
34
35 # Switch to the same workspace again to make sure it doesn’t get cleaned up
36 $i3->command("workspace $otmp")->recv;
37 $i3->command("workspace $otmp")->recv;
38 ok(workspace_exists($otmp), 'other workspace still exists');
39
40 diag( "Testing i3, Perl $], $^X" );