gitignoring
[p5sagit/Devel-GlobalDestruction.git] / t / basic.t
CommitLineData
a91e8a78 1#!/usr/bin/perl
2
3use strict;
4use 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
38d57e49 10BEGIN {
11 package Test::Scope::Guard;
12 sub new { my ($class, $code) = @_; bless [$code], $class; }
13 sub DESTROY { my $self = shift; $self->[0]->() }
14}
a91e8a78 15
16print "1..4\n";
17
18sub ok ($$) {
19 print "not " if !$_[0];
20 print "ok";
21 print " - $_[1]" if defined $_[1];
22 print "\n";
23}
24
25ok( eval "use Devel::GlobalDestruction; 1", "use Devel::GlobalDestruction" );
26
27ok( defined &in_global_destruction, "exported" );
28
29ok( !in_global_destruction(), "not in GD" );
30
38d57e49 31our $sg = Test::Scope::Guard->new(sub { ok( in_global_destruction(), "in GD" ) });
a91e8a78 32
33