On Fri, Jul 20, 2001 at 01:30:39AM -0400, Michael G Schwern wrote:
> On Fri, Jul 20, 2001 at 12:51:19AM -0400, barries wrote:
> >    1) skip dies, Test::Named::end() "catches" it, emits message
> >    2) todo_because sets a flag, is(), etc. check flag, T::N::begin clears it
> 
> Thank you, you just gave me a wonderful idea:

Worth every penny paid ;-).

> skip() will throw an exception.  test_block() will catch that
> exception and print something like:

Yeah, I played with this syntax a bit too, and decided I really like hte
metadata (test id, number of tests) at the top.  What I cam up with was

   test {
      test_name "foo" ;
      skip "barf" if $emetic ;
      is $stomach, $stable ;
   } ;

with test_name() being optional.  I didn't think of the number of tests
feature.  Could also do:

   test {
      plan tests => 3, name => "foo", todo => [2,3] ;
      skip "barf" if $emetic ;
      is $stomach, $stable ;
      is $ear,     $stable ;
      is $floor,   $stable ;
   } ;

or some such.  The nice thing is that if you don't want the fancy
features, you don't need them.  It scales well from simple, unplanned
scripting to tight, planned testing as need be throughout the script.

> I think this will work.  I just need a better name than test_block().

Me too.

- Barrie

Reply via email to