Summary: When the condition is blank (empty string), the test will pass although it shouldn't.
JUnit 3.5 has
perlUnit .13 has
There's a problem with empty string parameters and that's probably why the parameters were
reversed. However, I ran into the problem using the current order.
Using the fail-example provided, the test that fails is "born" =~ /loose/.
assert("born" =~ /loose/, "Born to lose ...");
For some reason this works as expected.
However, the following doesn't (the Test::Unit::TestCase variation):
$self->assert("born" =~ /loose/, "Born to lose ...");
but this will:
$self->assert(scalar "born" =~ /loose/, "Born to lose ...");
The doc for m// states "if there is no match, a false value ("") is returned". This being an empty
string results in only the message being passed as a parameter which is always true and so the
test doesn't fail as it should.
Anyway, this is a bad situation. Maybe assert should have a prototype requiring two params? If the
condition is second the test will always fail if no message is given. I think this is preferable to the
current state where the test will pass if there's an empty condition and a given message when it
Log in to post a comment.