tests: clean up/beautify all tests (code style / test style)
This commit is contained in:
@ -4,19 +4,14 @@
|
||||
# Tests whether we can switch to a non-existant workspace
|
||||
# (necessary for further tests)
|
||||
#
|
||||
use i3test tests => 3;
|
||||
|
||||
my $i3 = i3("/tmp/nestedcons");
|
||||
use i3test;
|
||||
|
||||
sub workspace_exists {
|
||||
my ($name) = @_;
|
||||
($name ~~ @{get_workspace_names()})
|
||||
}
|
||||
|
||||
my $tmp = get_unused_workspace();
|
||||
diag("Temporary workspace name: $tmp\n");
|
||||
|
||||
$i3->command("workspace $tmp")->recv;
|
||||
my $tmp = fresh_workspace;
|
||||
ok(workspace_exists($tmp), 'workspace created');
|
||||
# if the workspace could not be created, we cannot run any other test
|
||||
# (every test starts by creating its workspace)
|
||||
@ -24,17 +19,17 @@ if (!workspace_exists($tmp)) {
|
||||
BAIL_OUT('Cannot create workspace, further tests make no sense');
|
||||
}
|
||||
|
||||
my $otmp = get_unused_workspace();
|
||||
my $otmp = fresh_workspace;
|
||||
diag("Other temporary workspace name: $otmp\n");
|
||||
|
||||
# As the old workspace was empty, it should get
|
||||
# cleaned up as we switch away from it
|
||||
$i3->command("workspace $otmp")->recv;
|
||||
cmd "workspace $otmp";
|
||||
ok(!workspace_exists($tmp), 'old workspace cleaned up');
|
||||
|
||||
# Switch to the same workspace again to make sure it doesn’t get cleaned up
|
||||
$i3->command("workspace $otmp")->recv;
|
||||
$i3->command("workspace $otmp")->recv;
|
||||
cmd "workspace $otmp";
|
||||
cmd "workspace $otmp";
|
||||
ok(workspace_exists($otmp), 'other workspace still exists');
|
||||
|
||||
diag( "Testing i3, Perl $], $^X" );
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user