On Mon, 2007-11-19 at 13:06 +0000, Andy Armstrong wrote:
> On 19 Nov 2007, at 11:04, Ovid wrote:
> > I could get around this by loading all of the YAML files and  
> > checking their count, but then I'd have to load them *again* when I  
> > run the tests and that defeats the purpose of speeding up the test  
> > suite.
> 
> 
> I think we really need to reach a decision on
> 
> http://testanything.org/wiki/index.php/Test_Groups versus
> http://testanything.org/wiki/index.php/Test_Blocks

It looks like the con on both of these proposals is lack of backcompat.

My idea is to encode as much of the block information in the current
dialect of TAP as possible, and then add extra info in the comments that
new harnesses can process (and old harnesses can ignore).

How about:

<no current-style plan>
# PLAN 4 BLOCKS
# {BLOCK 1} 1..2
ok 1 - BLOCK{1} TEST{1} - and the usual comment
ok 2 - BLOCK{1} TEST{2}
# {BLOCK 2} PLAN NO_PLAN
ok 3 - BLOCK{2} TEST{1}
# {BLOCK 2} 1..1
# {BLOCK 3} 1..1
...
# {BLOCK 4} 1..2
<a total of 6 tests run over 4 blocks>
1..6

This is fully-backwards compatible with current harnesses, and even
provides most of the safety of the above proposals (a bit better than
no_plan, since the number at the bottom of the TAP is calculated based
on block declarations, not on number of tests run).  Blocks can also
nest, if you want.

One thing I might add is a symbol after the # like:

#@ this is a new-style TAP command

If the @ after the # (without a space separating them) is legal in TAP
1.0, then even Test::More::diag('@ BLOCK{1} 1..2') would still be
old-style TAP as far as the new parser is concerned (since it would
print "# @ BLOCK...").  Nifty.

Thoughts?

Regards,
Jonathan Rockway


Reply via email to