good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I posted this over at use.perl. I figured I'd stuff it here some someone else may learn from my pain. I'm such and idiot. I can't believe I never noticed this before. It's quite a dangerous oversight too since it meant tests didn't register a pass or a fail; no output at all which threw off the test counts. Don't let this happen to you.
Of course, if the module throws the exception, we pass. If it throws another exception (or die), we fail. But, if the module unexpectedly succeeds, we neither fail nor pass. That's not so bad right? THe count mismatch would cause the test to fail right? Sure, but picture this:
In this scenerio, you've added a test but forgot to update the test plan count. Now you've declared 2 tests and passed 2 tests. No failures and you never know a completely failing test...didn't. This is ever more true if you're using no_plan. Probably another reason not to ever do that. :-) Ths answer of course is to put a fail in the try block. Not something that seams obvious upon first thought.
Boy do I have a lot of test files to double check. That was a painful lesson. In reply to How not to test exceptions by jk2addict
|
|