I forgot to hit 'reply all' :)

Also, I had considered this:

  have $some_value, assuming { shift > 7 }, reason "Argument must be greater 
than 7";

And that would allow us to naturally put complex constraints onto the values.

 
Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6



----- Forwarded Message ----
> From: Ovid <publiustemp-perl...@yahoo.com>
> To: Colin Newell <colin.new...@gmail.com>
> Sent: Tuesday, 30 June, 2009 19:17:54
> Subject: Re: "Fluent" tests?
> 
> ----- Original Message ----
> 
> > From: Colin Newell 
> >
> > >  my $armageddon = $world->destruction;
> > >  false $armaggedon,
> > >      reason "World->destruction must never return true",
> > >      diagnostic { world => $world };
> > >
> > > I don't know that this is a brilliant interface, but just playing around 
> with 
> > it works (the have/want pair automatically falls back to Test::Differences 
> > if 
> > $have or $want is a reference).
> > >
> > > It's a lot more explicit that Test::More and friends.  That means it's a 
> > > lot 
> 
> > more verbose.  However, it's something which could be played with.
> >
> > At the hackathon Schwern and I had a go at implementing the ugly ->
> > type interface for Test::Builder2 based on an idea from a PDX.pm
> > meeting.
> > 
> > The idea being that it would work something like this,
> > 
> > ok($func('a'), 'some test')->diag('some cheap diagnostics');
> > 
> > or for delayed diagnostics,
> > 
> > {
> >     my $result = ok $func('a'), 'A test';
> >     if(!$result) {
> >         $result->diag("expensive diagnostics we'd rather not run");
> >     }
> > }
> > 
> > The idea being that these result objects would then be usable by
> > modules like Test::More and you would be able to easily attach
> > diagnostics in the right place.
> > 
> > Note that the block in the second example is a necessary evil for the
> > delayed diagnostics because of the way we make sure we don't produce
> > the output before we know what diagnostics come with the test.
> > 
> > I did have a go at writing this up at
> > http://colinnewell.wordpress.com/2009/03/31/perl-qa-hackathon-testbuilder2/.
> 
> I appreciate the work you've done and I think it would be an improvement over 
> what we have.  However, rather than settle for "good", I'm wondering what 
> would 
> be "great"?  I certainly don't know that I have the answer here, so I would 
> love 
> to see what people think is an INCREDIBLE interface for writing tests.
> 
> 
> Cheers,
> Ovid
> --
> Buy the book         - http://www.oreilly.com/catalog/perlhks/
> Tech blog            - http://use.perl.org/~Ovid/journal/
> Twitter              - http://twitter.com/OvidPerl
> Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Reply via email to