diff options
author | Steffen Mueller <smueller@cpan.org> | 2012-10-16 17:27:47 +0200 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2012-10-16 17:27:47 +0200 |
commit | 07e2e970a070734488a530ac34f1ae7b61e43a43 (patch) | |
tree | ae44c0f138886c85430b43316938acdf310f6354 /cpan/AutoLoader/t | |
parent | 4e375cef4c9fb6974eb23e2ace1fb9ef0f42ce3f (diff) | |
download | perl-07e2e970a070734488a530ac34f1ae7b61e43a43.tar.gz |
cpan: Upgrade AutoLoader to 5.73
Just syncing to CPAN release.
Diffstat (limited to 'cpan/AutoLoader/t')
-rw-r--r-- | cpan/AutoLoader/t/01AutoLoader.t | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/cpan/AutoLoader/t/01AutoLoader.t b/cpan/AutoLoader/t/01AutoLoader.t index dcee5c518a..aa52904d1f 100644 --- a/cpan/AutoLoader/t/01AutoLoader.t +++ b/cpan/AutoLoader/t/01AutoLoader.t @@ -18,7 +18,7 @@ BEGIN unshift @INC, $dir; } -use Test::More tests => 18; +use Test::More tests => 21; sub write_file { my ($file, $text) = @_; @@ -53,6 +53,12 @@ write_file( File::Spec->catfile( $fulldir, 'blechanawilla.al' ), $blechanawilla_ # to find the above file so we duplicate it where they should find it. write_file( File::Spec->catfile( $fulldir, 'blechanawil.al' ), $blechanawilla_text ); +write_file( File::Spec->catfile( $fulldir, 'notreached.al' ), <<'EOT' ); +package Foo; +sub notreached { die "Should not be reached!" } +1; +EOT + # Let's define the package package Foo; require AutoLoader; @@ -61,6 +67,7 @@ AutoLoader->import( 'AUTOLOAD' ); sub new { bless {}, shift }; sub foo; sub bazmarkhianish; +sub notreached; package main; @@ -118,6 +125,16 @@ EOT Foo::a(); +# Test whether autoload_sub works without actually executing the function +ok(!defined(&Foo::notreached), "Foo::notreached unknown to boot"); +AutoLoader::autoload_sub("Foo::notreached"); +ok(defined(&Foo::notreached), "Foo::notreached loaded by autoload_sub"); + +# Make sure that repeatedly calling autoload_sub is not a problem: +AutoLoader::autoload_sub("Foo::notreached"); +eval {Foo::notreached;}; +ok($@ && $@ =~ /Should not/, "Foo::notreached works as expected"); + package Bar; AutoLoader->import(); ::ok( ! defined &AUTOLOAD, 'AutoLoader should not export AUTOLOAD by default' ); |