6 use Test::More tests => 9;
8 use CPANPLUS::Dist::Gentoo::Guard;
11 my $hook = sub { $called++ };
13 is $called, 0, 'not called yet';
15 my $guard = CPANPLUS::Dist::Gentoo::Guard->new($hook);
16 is $called, 0, 'creating the guard doesn\'t call the hook';
18 is $called, 1, 'called at end of scope';
21 is $called, 0, '$called reset';
23 my $guard = CPANPLUS::Dist::Gentoo::Guard->new($hook);
25 is $called, 0, 'unarming the guard doesn\'t call the hook';
27 is $called, 0, 'not called at end of scope';
30 is $called, 0, '$called reset again';
32 my $guard = CPANPLUS::Dist::Gentoo::Guard->new($hook);
34 is $called, 1, 'called DESTROY explicitely';
36 is $called, 1, 'the hook was called only once';