Jasper has asked for the wisdom of the Perl Monks concerning the following question:
I was perplexed, because this test was passing, even when a test further down the line revealed that it should have failed.$self->assert($case =~ /test text/, "warning message here");
And all was well. Must be something to do with the list context of the match in a failure case returning nothing, and the tested argument being the warning message. Is there a better way to avoid this? Is there a better way to test things like this? I've left my last job, and, as I say, I'm sure I've left UXBs of this kind there.my $result = $case =~ /test text/; $self->assert($result, "warning message");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trap in Test::Unit::Assert? Avoidance
by Joost (Canon) on Mar 10, 2005 at 13:08 UTC | |
by Jasper (Chaplain) on Mar 10, 2005 at 14:17 UTC | |
|
Re: Trap in Test::Unit::Assert? Avoidance
by Anonymous Monk on Mar 10, 2005 at 13:05 UTC | |
by Jasper (Chaplain) on Mar 10, 2005 at 14:21 UTC | |
by Anonymous Monk on Mar 10, 2005 at 15:21 UTC |