2 # vim:ts=4:sw=4:expandtab
4 # Tests whether we can switch to a non-existant workspace
5 # (necessary for further tests)
9 my $i3 = i3("/tmp/nestedcons");
11 sub workspace_exists {
13 ($name ~~ @{get_workspace_names()})
16 my $tmp = get_unused_workspace();
17 diag("Temporary workspace name: $tmp\n");
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');
27 my $otmp = get_unused_workspace();
28 diag("Other temporary workspace name: $otmp\n");
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');
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');
40 diag( "Testing i3, Perl $], $^X" );