Upgrade to PathTools 3.25
[p5sagit/p5-mst-13.2.git] / lib / AutoLoader.t
index da7071b..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' );
@@ -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;