in reply to 'either or' value unit test case in Test::Simple or Test::More
I would write that as separate pass calls, which allows you to see which one matched.
if ($var eq 'a') { pass( 'var is an a' ); } elsif ($var eq 'b') { pass( 'var is a b' ); } else { fail( "var was $var" ); }
Be careful here and don't go too tricky in the code flow, otherwise you may end up with a pass() in one branch, and nothing in the other, which will lead to strange off-by-one errors in the test plan. KISS.
• another intruder with the mooring in the heart of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 'either or' value unit test case in Test::Simple or Test::More
by ferreira (Chaplain) on Jan 05, 2007 at 16:43 UTC | |
by grinder (Bishop) on Jan 05, 2007 at 16:49 UTC |