X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcrash.t;h=44bb461a949c5b6fa4dae4c91f0a9fe7b90f63fa;hb=e12af862ff034c1757248c0faf517ad2a917e5c9;hp=51342931132faf3e3daf7f46a8ec631d8c178679;hpb=32afac104b1b9c43ec0c986da013194f918577b6;p=p5sagit%2Fstrictures.git diff --git a/t/crash.t b/t/crash.t index 5134293..44bb461 100644 --- a/t/crash.t +++ b/t/crash.t @@ -1,16 +1,29 @@ -use strictures; +use strict; +use warnings FATAL => 'all'; +use Test::More + "$]" < 5.008004 ? ( skip_all => "can't test extra loading on perl < 5.8.4" ) + : ( tests => 1 ); +use File::Spec; -use Test::More tests => 1; +my %extras = map { my $m = "$_.pm"; $m =~ s{::}{/}g; $m => 1 } qw( + indirect + multidimensional + bareword::filehandles +); -SKIP: { - skip 'Have all the modules; can\'t check this', 1 - unless not eval { - require indirect; - require multidimensional; - require bareword::filehandles; - 1; - }; +unshift @INC, sub { + my $mod = $_[1]; + die "Can't locate $mod in \@INC\n" + if $extras{$mod}; + return 0; +}; - pass('can manage to survive with some modules missing!'); -} +my $err = do { + local $ENV{PERL_STRICTURES_EXTRA} = 1; + local *STDERR; + open STDERR, '>', File::Spec->devnull; + eval q{use strictures;}; + $@; +}; +is $err, '', 'can manage to survive with some modules missing!';