2010-04-16 14:24:29 +02:00
|
|
|
|
#!perl
|
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
|
#
|
|
|
|
|
# Tests whether we can switch to a non-existant workspace
|
|
|
|
|
# (necessary for further tests)
|
|
|
|
|
#
|
2011-03-09 20:25:17 +01:00
|
|
|
|
use i3test;
|
2010-04-16 14:24:29 +02:00
|
|
|
|
|
|
|
|
|
sub workspace_exists {
|
2010-04-16 14:34:12 +02:00
|
|
|
|
my ($name) = @_;
|
|
|
|
|
($name ~~ @{get_workspace_names()})
|
2010-04-16 14:24:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
|
my $tmp = fresh_workspace;
|
2010-04-16 14:24:29 +02:00
|
|
|
|
ok(workspace_exists($tmp), 'workspace created');
|
2010-04-16 15:03:27 +02:00
|
|
|
|
# if the workspace could not be created, we cannot run any other test
|
|
|
|
|
# (every test starts by creating its workspace)
|
|
|
|
|
if (!workspace_exists($tmp)) {
|
|
|
|
|
BAIL_OUT('Cannot create workspace, further tests make no sense');
|
|
|
|
|
}
|
2010-04-16 14:24:29 +02:00
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
|
my $otmp = fresh_workspace;
|
2010-04-16 14:24:29 +02:00
|
|
|
|
diag("Other temporary workspace name: $otmp\n");
|
|
|
|
|
|
|
|
|
|
# As the old workspace was empty, it should get
|
|
|
|
|
# cleaned up as we switch away from it
|
2011-03-09 20:25:17 +01:00
|
|
|
|
cmd "workspace $otmp";
|
2010-04-16 14:24:29 +02:00
|
|
|
|
ok(!workspace_exists($tmp), 'old workspace cleaned up');
|
|
|
|
|
|
2010-05-09 23:20:49 +02:00
|
|
|
|
# Switch to the same workspace again to make sure it doesn’t get cleaned up
|
2011-03-09 20:25:17 +01:00
|
|
|
|
cmd "workspace $otmp";
|
|
|
|
|
cmd "workspace $otmp";
|
2010-05-09 23:20:49 +02:00
|
|
|
|
ok(workspace_exists($otmp), 'other workspace still exists');
|
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
|
done_testing;
|