blob: a51903a4e26a37f49e045cf47f275fdd4ae38ea3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use strict;
use warnings;
use Test::More;
use_ok("Server::Starter::Guard");
subtest "guard is called when it goes out of scope" => sub {
my $cnt = 0;
my $guard = Server::Starter::Guard->new(sub {
$cnt++;
});
is $cnt, 0;
undef $guard;
is $cnt, 1;
};
subtest "guard can be dismissed" => sub {
my $cnt = 0;
my $guard = Server::Starter::Guard->new(sub {
$cnt++;
});
$guard->dismiss;
undef $guard;
is $cnt, 0;
};
done_testing;
|