in reply to Re: Test on calling undefined subs fails and exits test
in thread Test on calling undefined subs fails and exits test
I'm taken with Test::Trap, I can be a little clearer with what is happening in the test names.
The sub leaves by dieing and not exiting. And it is starting to look like the finalize() routine is a test module death. But I already knew that of course
subtest 'calling undefined routine dies' => sub { my @r = trap{ working_l::setlist() }; is( $trap->leaveby, 'die', "calling &working_l::setlist dies" ); like( $trap->die, qr/(?=.*finalize)/i, "&working_l::setlist dies with + finalize err" ); }; ---output--- ok 1 - require 'working_l.pl'; ok 2 # skip workinprogress ok 1 - calling &working_l::setlist dies not ok 2 - &working_l::setlist dies with finalize err # Failed test '&working_l::setlist dies with finalize err' # at working.t line 36. # 'Undefined subroutine &working_l::setlist call +ed at working.t line 33. # ' # doesn't match '(?^i:(?=.*finalize))' 1..2 # Looks like you failed 1 test of 2.
|
|---|