diff options
author | Peter Scott <Peter@PSDT.com> | 2002-11-07 11:04:27 -0800 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-11-19 22:11:24 +0000 |
commit | 94825128f215c164961da3f6ffd645af41f1d5db (patch) | |
tree | a0ef5afa9a066c3c72ae4dfbaab876e6565e269d /lib/AutoLoader.t | |
parent | c8dae523ee7d36f845a2fdbbbb34116da97972e4 (diff) | |
download | perl-94825128f215c164961da3f6ffd645af41f1d5db.tar.gz |
Re: [PATCH] AutoLoader gives wrong message
Message-id: <4.3.2.7.2.20021107185902.00b93ec0@shell2.webquarry.com>
With a tweak to the END cleanup block to fully remove the
temporary test directory
p4raw-id: //depot/perl@18163
Diffstat (limited to 'lib/AutoLoader.t')
-rwxr-xr-x | lib/AutoLoader.t | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/AutoLoader.t b/lib/AutoLoader.t index 2db1d60ed1..408b281126 100755 --- a/lib/AutoLoader.t +++ b/lib/AutoLoader.t @@ -16,7 +16,7 @@ BEGIN unshift @INC, $dir; } -use Test::More tests => 13; +use Test::More tests => 14; # First we must set up some autoloader files my $fulldir = File::Spec->catdir( $dir, 'auto', 'Foo' ); @@ -49,6 +49,24 @@ sub bazmarkhianish { shift; shift || "baz" } EOT close(BAZ); +open(BLECH, '>', File::Spec->catfile( $fulldir, 'blechanawilla.al' )) + or die "Can't open blech file: $!"; +print BLECH <<'EOT'; +package Foo; +sub blechanawilla { compilation error ( +EOT +close(BLECH); + +# This is just to keep the old SVR3 systems happy; they may fail +# to find the above file so we duplicate it where they should find it. +open(BLECH, '>', File::Spec->catfile( $fulldir, 'blechanawil.al' )) + or die "Can't open blech file: $!"; +print BLECH <<'EOT'; +package Foo; +sub blechanawilla { compilation error ( +EOT +close(BLECH); + # Let's define the package package Foo; require AutoLoader; @@ -85,6 +103,14 @@ is( $foo->bar($1), 'foo', '(again)' ); is( $foo->bazmarkhianish($1), 'foo', 'for any method call' ); is( $foo->bazmarkhianish($1), 'foo', '(again)' ); +# Used to retry long subnames with shorter filenames on any old +# exception, including compilation error. Now AutoLoader only +# tries shorter filenames if it can't find the long one. +eval { + $foo->blechanawilla; +}; +like( $@, qr/syntax error/, 'require error propagates' ); + # test recursive autoloads open(F, '>', File::Spec->catfile( $fulldir, 'a.al')) or die "Cannot make 'a' file: $!"; @@ -130,5 +156,5 @@ package main; # cleanup END { return unless $dir && -d $dir; - rmtree $fulldir; + rmtree $dir; } |