# from Ovid
# on Thursday 22 January 2009 13:01:

>Show us the code.
>
>No, don't show us an "ideal" API; show us the real, actual code.  Even
> a simple proof of concept would be fine.  Seriously.  Show us the
> code.

I'm not sure whether this would qualify as either an ideal API or real 
actual serious code.  I happen to be working on some other real actual 
seriously code today, but anyhow:

  sub test (&) {
    my $subref = shift;

    local $Something::something;
    $subref->();
    finished();
  }

  test {
    ...
    ok(1);
    ok(1);
    ...
  };
  test {
    ...
    ok(1);
  };

Or thereabouts.  The business of skipping, todoing, counting, planning, 
and ensuring that all tests actually run is going to involve various 
details and possibly even get into the limitations of TAP -- but you 
now have every chunk of tests setup for later/encapsulated evaluation.  
One way to punt toward that would be to treat each block as a single 
test ala is_deeply().  A similar approach would handle loops.

This perhaps loses some granularity within each block.  It also assumes 
perl 5 limitations.  Possibly neither issue sticks in perl 6.

One could even simply stack the blocks and finish the test file with 
run_tests_now(), which would essentially start the whole planning 
process.

Other details of the implementation will be up to the implementor.  If 
that's me, I suppose I should have learned by now not to bother making 
a suggestion.

--Eric
-- 
"Everything should be made as simple as possible, but no simpler."
--Albert Einstein
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to