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