X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FAutoLoader.t;h=92d66fa7314d7ec550b552209b9f2887e2d99f7f;hb=3776488a91c6ecae36acc5af47fc83f9a8e61fc9;hp=9f0804b00459691cbbba290679ed9291faf15048;hpb=00bb01c7233bf772ebf55cca8a616f81a2c29810;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/AutoLoader.t b/lib/AutoLoader.t index 9f0804b..92d66fa 100755 --- a/lib/AutoLoader.t +++ b/lib/AutoLoader.t @@ -16,7 +16,7 @@ BEGIN unshift @INC, $dir; } -use Test::More tests => 21; +use Test::More tests => 22; # First we must set up some autoloader files my $fulldir = File::Spec->catdir( $dir, 'auto', 'Foo' ); @@ -121,7 +121,7 @@ is( $foo->bazmarkhianish($1), 'foo', '(again)' ); eval { $foo->blechanawilla; }; -like( $@, qr/syntax error/, 'require error propagates' ); +like( $@, qr/syntax error/i, 'require error propagates' ); # test recursive autoloads open(F, '>', File::Spec->catfile( $fulldir, 'a.al')) @@ -164,8 +164,21 @@ AutoLoader->unimport(); ::is( Baz->AUTOLOAD(), 'i am here', '... but not non-imported AUTOLOAD()' ); + +package SomeClass; +use AutoLoader 'AUTOLOAD'; +sub new { + bless {} => shift; +} + package main; +$INC{"SomeClass.pm"} = $0; # Prepare possible recursion +{ + my $p = SomeClass->new(); +} # <-- deep recursion in AUTOLOAD looking for SomeClass::DESTROY? +::ok(1, "AutoLoader shouldn't loop forever if \%INC is modified"); + # cleanup END { return unless $dir && -d $dir;