On Wed, Jan 16, 2008 at 05:38:32AM -0600, Patrick R. Michaud wrote: : Nice. What about the cases where a test file defines its own local : wrapper functions to is, isnt, like, etc.? For example, Pugs' : t/builtins/math/sqrt.t has: : : sub is_approx (Num $is, Num $expected, Str $descr) { : ok abs($is - $expected) <= 0.00001, $descr; : } : : and then does things like : : is_approx(sqrt(2), 1.4142135623730951, 'got the square root of 2'); : is_approx(sqrt(5), 2.23606797749979, 'got the square root of 5'); : ok sqrt(-1), NaN, 'sqrt(-1) is NaN'; : : It looks as though util/fudge would count this as only one test : instead of three.
True. We could reserve all the is_* isnt_* ok_* names for that, I suppose. Other approaches are also possible, including recognizing the definitions of such subs. Or we can have a "{ # plan 3" override and not scan the block at all. That would only help with the block form though... In any case, I'm not terribly worried about it getting out of sync with the test numbers; that's what the overall plan count is for, and the textual output of each test makes it pretty easy to find missing tests. It's also the case that either eval '' or try {...} can fail part way through and throw the test numbering off. Larry