On Tue, Jan 15, 2008 at 11:16:57PM -0800, Larry Wall wrote:
> On Sun, Jan 13, 2008 at 11:22:44PM -0600, Patrick R. Michaud wrote:
> : Larry, Jerry, and I discussed this a couple of weeks ago
> : and here's my vision for how it should work.  To simplify
> : things, let's break it into two parts:  (1) how to mark tests
> : as 'todo', and (2) how to do this for specific implementations.
> 
> I've just checked in a "util/fudge" preproprocessor into the pugs
> repo that approximates what we've been talking about, or at least my
> version of it. :)  

Yay!  Thanks!  

> : Calling C<< todo('foo', 3); >> says that the next three tests are
> : to be marked as TODO with 'foo' given as a reason.  
> 
> Unfortunately, the pugs Test::todo function doesn't take a count there,
> but it's not needed in the preprocessor approach.  

I've been thinking that we should perhaps modify Pugs' 
Test::todo to accept a count.  But I don't think that's
a conflict with util/fudge.


> If you use the block form, it automatically scans the block
> for the number of tests, so you can also say:
> 
>     #?rakudo: skip 'unimpl'
>     #?smop: eval 'parsefail'
>     #?pugs: todo 'foo'
>     {
>       is(...);
>       is(...);
>       is(...);
>     }
> 
> and it automatically installs the correct skip count where needed.

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.

Pm

Reply via email to