Fix some meta info
[p5sagit/Devel-GlobalDestruction.git] / t / 01_basic.t
CommitLineData
a91e8a78 1use strict;
2use warnings;
3
9aaf3646 4BEGIN {
5 if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) {
6 require DynaLoader;
7 no warnings 'redefine';
8 my $orig = \&DynaLoader::bootstrap;
9 *DynaLoader::bootstrap = sub {
10 die 'no XS' if $_[0] eq 'Devel::GlobalDestruction';
11 goto $orig;
12 };
13 }
14}
a91e8a78 15
38d57e49 16BEGIN {
17 package Test::Scope::Guard;
18 sub new { my ($class, $code) = @_; bless [$code], $class; }
19 sub DESTROY { my $self = shift; $self->[0]->() }
20}
a91e8a78 21
22print "1..4\n";
23
24sub ok ($$) {
f832e240 25 print "not " if !$_[0];
26 print "ok";
27 print " - $_[1]" if defined $_[1];
28 print "\n";
a91e8a78 29}
30
31ok( eval "use Devel::GlobalDestruction; 1", "use Devel::GlobalDestruction" );
32
33ok( defined &in_global_destruction, "exported" );
34
35ok( !in_global_destruction(), "not in GD" );
36
38d57e49 37our $sg = Test::Scope::Guard->new(sub { ok( in_global_destruction(), "in GD" ) });