X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FAutoLoader.t;h=9ed79e3f4a8af2c2e0a89b961f04324a492fca5c;hb=34ba6322b644154d55680c95808981776852ae24;hp=408b281126ecdb10e13ae9f5726ffa6a24f95b27;hpb=94825128f215c164961da3f6ffd645af41f1d5db;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/AutoLoader.t b/lib/AutoLoader.t index 408b281..9ed79e3 100755 --- a/lib/AutoLoader.t +++ b/lib/AutoLoader.t @@ -16,7 +16,7 @@ BEGIN unshift @INC, $dir; } -use Test::More tests => 14; +use Test::More tests => 17; # First we must set up some autoloader files my $fulldir = File::Spec->catdir( $dir, 'auto', 'Foo' ); @@ -73,19 +73,28 @@ require AutoLoader; AutoLoader->import( 'AUTOLOAD' ); sub new { bless {}, shift }; +sub foo; +sub bar; +sub bazmarkhianish; package main; my $foo = new Foo; +my $result = $foo->can( 'foo' ); +ok( $result, 'can() first time' ); is( $foo->foo, 'foo', 'autoloaded first time' ); is( $foo->foo, 'foo', 'regular call' ); +is( $result, \&Foo::foo, 'can() returns ref to regular installed sub' ); eval { $foo->will_fail; }; like( $@, qr/^Can't locate/, 'undefined method' ); +$result = $foo->can( 'will_fail' ); +ok( ! $result, 'can() should fail on undefined methods' ); + # Used to be trouble with this eval { my $foo = new Foo;