X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F06_load-in-gd.t;fp=t%2F06_load-in-gd.t;h=f51c4015d3165a2cbddb81557e886efe5c66f82d;hb=350bef653f634d1c7cb7357b45e1835b1489f9b7;hp=0000000000000000000000000000000000000000;hpb=e00dea6cd9072706aa8b8e705b9ecb8b7f7b913c;p=p5sagit%2FDevel-GlobalDestruction.git diff --git a/t/06_load-in-gd.t b/t/06_load-in-gd.t new file mode 100644 index 0000000..f51c401 --- /dev/null +++ b/t/06_load-in-gd.t @@ -0,0 +1,26 @@ +use strict; +use warnings; + +BEGIN { + if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) { + unshift @INC, sub { + die 'no XS' if $_[1] eq 'Devel/GlobalDestruction/XS.pm'; + }; + } +} + +{ + package Test::Scope::Guard; + sub new { my ($class, $code) = @_; bless [$code], $class; } + sub DESTROY { my $self = shift; $self->[0]->() } +} + +print "1..1\n"; + +our $alive = Test::Scope::Guard->new(sub { + require Devel::GlobalDestruction; + my $gd = Devel::GlobalDestruction::in_global_destruction(); + print(($gd ? '' : 'not ') . "ok 1 - global destruct detected when loaded during GD\n"); + exit($gd ? 0 : 1); +}); +