[Pdx-pm] Test::Builder calling convention

David E. Wheeler david at kineticode.com
Sat Mar 14 21:46:38 PDT 2009


On Mar 13, 2009, at 10:24 PM, Michael G Schwern wrote:

> Nope.  The result object stores the diagnostic and then the (currently
> non-existent) output object decides what to output, where and how.
>
> A TAP output object, using normal comment diagnostics, would simply  
> not
> display the diagnostic at all if the test passed.  So if it passed  
> you might see:
>
>    ok 1
>
> and if it failed
>
>    not ok 1
>    # fail!

That would be fine if there was some way to distinguish failure  
diagnostics from other kinds of diagnostics. Maybe diag() and err()?

> Your diagnostic is really more the name.  It might instead look like  
> this:
>
>    return $builder->ok( !open my $fh, $file )
>             ->name("Can't open $file for reading")
>             ->and
>             ->is( $!, ENOBACON )
>             ->name( "Insufficient bacon" );

That really does start to strike me as overly OO.

Best,

David


More information about the Pdx-pm-list mailing list