[patch@31998] Fix M:B: tilde.t tests on VMS
[p5sagit/p5-mst-13.2.git] / lib / AutoLoader.t
index 9f0804b..92d66fa 100755 (executable)
@@ -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;