Add a thread test (just runs the basic one in a thread)
[p5sagit/Devel-GlobalDestruction.git] / t / 01_basic.t
CommitLineData
a91e8a78 1use strict;
2use 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 8BEGIN {
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
14print "1..4\n";
15
16sub ok ($$) {
f832e240 17 print "not " if !$_[0];
18 print "ok";
19 print " - $_[1]" if defined $_[1];
20 print "\n";
a91e8a78 21}
22
23ok( eval "use Devel::GlobalDestruction; 1", "use Devel::GlobalDestruction" );
24
25ok( defined &in_global_destruction, "exported" );
26
27ok( !in_global_destruction(), "not in GD" );
28
38d57e49 29our $sg = Test::Scope::Guard->new(sub { ok( in_global_destruction(), "in GD" ) });