From: Peter Rabbitson Date: Wed, 8 Aug 2012 17:02:11 +0000 (+0200) Subject: Make sure the pure-perl test *is* pure-perl X-Git-Tag: Devel-GlobalDestruction-0.09~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82ca1dd86de69da01a9f7f746785a29f6afcaa42;p=p5sagit%2FDevel-GlobalDestruction.git Make sure the pure-perl test *is* pure-perl --- diff --git a/t/01_basic.t b/t/01_basic.t index 3c3ffbd..b93496a 100644 --- a/t/01_basic.t +++ b/t/01_basic.t @@ -3,13 +3,19 @@ use warnings; BEGIN { if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) { - require DynaLoader; + no strict 'refs'; no warnings 'redefine'; - my $orig = \&DynaLoader::bootstrap; - *DynaLoader::bootstrap = sub { - die 'no XS' if $_[0] eq 'Devel::GlobalDestruction'; - goto $orig; - }; + + for my $f (qw(DynaLoader::bootstrap XSLoader::load)) { + my ($mod) = $f =~ /^ (.+) \:\: [^:]+ $/x; + eval "require $mod" or die $@; + + my $orig = \&$f; + *$f = sub { + die 'no XS' if ($_[0]||'') eq 'Devel::GlobalDestruction'; + goto $orig; + }; + } } } diff --git a/t/02_thread.t b/t/02_thread.t index 9032546..bcf4878 100644 --- a/t/02_thread.t +++ b/t/02_thread.t @@ -24,13 +24,19 @@ use warnings; BEGIN { if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) { - require DynaLoader; + no strict 'refs'; no warnings 'redefine'; - my $orig = \&DynaLoader::bootstrap; - *DynaLoader::bootstrap = sub { - die 'no XS' if $_[0] eq 'Devel::GlobalDestruction'; - goto $orig; - }; + + for my $f (qw(DynaLoader::bootstrap XSLoader::load)) { + my ($mod) = $f =~ /^ (.+) \:\: [^:]+ $/x; + eval "require $mod" or die $@; + + my $orig = \&$f; + *$f = sub { + die 'no XS' if ($_[0]||'') eq 'Devel::GlobalDestruction'; + goto $orig; + }; + } } }