Adam Kennedy wrote:
Geoffrey Young wrote:
hi all :)

there's a feature split I'm itching for in Test::Builder, etc - the
ability to call is() and have it emit TAP free from the confines of
plan().  not that I don't want to call plan() (or no_plan) but I want to
do that in a completely separate perl interpreter.  for example, I want
to do something that looks a bit like this

  use Test::More tests => 1;

  print qx!perl t/response.pl!;

where response.pl makes a series of calls to is(), ok(), whatever.
while this may seem odd it's actually not - I'd like to be able to
plan() tests within a client *.t script but have the responses come from
one (or more) requests to any kind of server (httpd, smtp, whatever).

currently in httpd land we can do this by calling plan() and is() from
within a single server-side perl script, but the limitation there is
that you can only do that once - if I want to test, say, keepalives I
can't have a single test script make multiple requests each with their
own plan() calls without things getting tripped up.

so, I guess my question is whether the plan->is linkage can be broken in
Test::Builder/Test::Harness/wherever and still keep the bookkeeping in
tact so that the library behaves the same way for the bulk case.  or
maybe at least provide some option where calls to is() don't bork out
because there's no plan (and providing an option to Test::More where it
doesn't send a plan header).

so, thoughts or ideas?  am I making any sense?

--Geoff

One of the problems is going to be numbering, surely?


This works:


---test.pl---
use Test::More tests => 1;

my $Test = Test::More->builder;
my $counter = $Test->current_test;

print qx!perl t/response.pl!;

$Test->current_test($counter + 1);

__END__


---response.pl---
use Test::More no_plan => 1;

Test::More->builder->no_header(1);
Test::More->builder->no_ending(1);

pass ('this was a passing test');

___END___

The problem was the test.pl file counter was never incremented so it never saw the planned test.


Reply via email to