Just another Perl shrine | |
PerlMonks |
Re: Test::Exception extension with (evil?) overloadingby John M. Dlugosz (Monsignor) |
on Jan 18, 2003 at 02:06 UTC ( [id://227897]=note: print w/replies, xml ) | Need Help?? |
I've only just started looking into Test::More and its kin, but the only other idea I have off hand is to pass a closure to a test function, to defer calling it until after the reusable code can throw an eval around it. That's what you mean by lives_and_is, right? Your complaint is that you have to duplicate all the tests to have a "lives" version. So, you want to wrap the sub-ref argument so that it can orthogonally apply to all the tests. Another way to have a modifier that applies orthogonally to all tests would be to pass the underlying test as well: This would evaluate subref in an eval, failing if it dies. Then, take the result and pass it, along with the remaining @args, to the innertest function, whose result is returned. So you could pass anything you want as the inner test.
—John
In Section
Seekers of Perl Wisdom
|
|