X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcrash.t;fp=t%2Fcrash.t;h=4aebc1c24d6a1b5597e49961396f646cafc9a4dd;hb=7c7063c9bce905f3146305267492ce4b49a73c76;hp=51342931132faf3e3daf7f46a8ec631d8c178679;hpb=6a190a72fa716030dbeb1a4218a038009d100d40;p=p5sagit%2Fstrictures.git diff --git a/t/crash.t b/t/crash.t index 5134293..4aebc1c 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!';