Commit | Line | Data |
a91e8a78 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | # we need to run a test in GD and this fails |
5 | # use Test::More tests => 3; |
6 | # use ok 'Devel::GlobalDestruction'; |
7 | |
38d57e49 |
8 | BEGIN { |
9 | package Test::Scope::Guard; |
10 | sub new { my ($class, $code) = @_; bless [$code], $class; } |
11 | sub DESTROY { my $self = shift; $self->[0]->() } |
12 | } |
a91e8a78 |
13 | |
14 | print "1..4\n"; |
15 | |
16 | sub ok ($$) { |
f832e240 |
17 | print "not " if !$_[0]; |
18 | print "ok"; |
19 | print " - $_[1]" if defined $_[1]; |
20 | print "\n"; |
a91e8a78 |
21 | } |
22 | |
23 | ok( eval "use Devel::GlobalDestruction; 1", "use Devel::GlobalDestruction" ); |
24 | |
25 | ok( defined &in_global_destruction, "exported" ); |
26 | |
27 | ok( !in_global_destruction(), "not in GD" ); |
28 | |
38d57e49 |
29 | our $sg = Test::Scope::Guard->new(sub { ok( in_global_destruction(), "in GD" ) }); |