in reply to Possible to catch undefined sub at "compile" time?
package foo; use warnings; use strict; sub monk { return 42; } sub go { return mink(123); } 1; __END__
Running the test yields:use strict; use warnings; use Test::More tests => 3; use lib qw (.); BEGIN { use_ok('foo'); } # ------ monk ------ cmp_ok(foo::monk(), q{==}, 42, q{Expect monk to return 42}); # ------ go ------ cmp_ok(foo::go(), q{==}, 42, q{Expect go to return 42}); __END__
$ prove foo.t foo....ok 1/3Undefined subroutine &foo::mink called at foo.pm line 8. # Looks like you planned 3 tests but only ran 2. # Looks like your test died just after 2. foo....dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED test 3 Failed 1/3 tests, 66.67% okay Failed Test Stat Wstat Total Fail List of Failed ---------------------------------------------------------------------- +--------- foo.t 255 65280 3 2 3 Failed 1/1 test scripts. 1/3 subtests failed. Files=1, Tests=3, 1 wallclock secs ( 0.04 cusr + 0.00 csys = 0.04 C +PU) Failed 1/1 test programs. 1/3 subtests failed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Possible to catch undefined sub at "compile" time?
by Anonymous Monk on Oct 10, 2007 at 11:45 UTC | |
by jhourcle (Prior) on Oct 10, 2007 at 12:05 UTC | |
by andreas1234567 (Vicar) on Oct 10, 2007 at 11:55 UTC |