2 # vim:ts=4:sw=4:expandtab
4 # Tests whether we can switch to a non-existant workspace
5 # (necessary for further tests)
10 my $i3 = i3("/tmp/nestedcons");
12 sub workspace_exists {
14 ($name ~~ @{get_workspace_names()})
17 my $tmp = get_unused_workspace();
18 diag("Temporary workspace name: $tmp\n");
20 $i3->command("workspace $tmp")->recv;
21 ok(workspace_exists($tmp), 'workspace created');
22 # if the workspace could not be created, we cannot run any other test
23 # (every test starts by creating its workspace)
24 if (!workspace_exists($tmp)) {
25 BAIL_OUT('Cannot create workspace, further tests make no sense');
28 my $otmp = get_unused_workspace();
29 diag("Other temporary workspace name: $otmp\n");
31 # As the old workspace was empty, it should get
32 # cleaned up as we switch away from it
33 $i3->command("workspace $otmp")->recv;
34 ok(!workspace_exists($tmp), 'old workspace cleaned up');
36 # Switch to the same workspace again to make sure it doesn’t get cleaned up
37 $i3->command("workspace $otmp")->recv;
38 $i3->command("workspace $otmp")->recv;
39 ok(workspace_exists($otmp), 'other workspace still exists');
41 diag( "Testing i3, Perl $], $^X" );