I posted this to the bug forum but thought I should do it here too.
Summary: When the condition is blank (empty string), the test will pass
although it shouldn't. m// returns an empty string on no match.
JUnit 3.5 has
assert(message, condition);
perlUnit .13 has
assert(condition, message);
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 should fail.
-Kevin Connor
Interwoven
_______________________________________________
Perlunit-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/perlunit-devel