On 27 Jan 2008, at 00:40, Ian Malpass wrote:

I'm writing Test::Pod::URI, which is going to follow pretty much the same structure as Test::Pod::Coverage. As such, I've got a subroutine all_pod_uris_ok() which will find all the POD files in a distro and test them using the pod_uris_ok() subroutine. Each one of those calls is a test, so it counts the number of files it finds, and asserts that number as its planned number of tests (using Test::Builder's plan() method).

So, I created a test using Test::Builder::Tester to test it which basically lies to the subroutine about where it should look for the POD, and it seems to work OK apart from the fact that I can't actually make the planning work - all_pod_uris_ok() asserts a plan, and because I'm using Test::Builder::Tester that plan still gets asserted in the scope of the test, so Test::More complains when I try to plan the number of Test::Builder::Tester tests I'm running.

Any clues how to overcome the problem?
[snip]

Off the top of my head... have something like:

  fail( "plan incorrect" )
    if Test::Builder->new->expected_test != $num_expected_tests;

at the end of your test suite? You'll get an extra test at the end of a failed run, which is a little inelegant I guess.

Alternatively can redirect all of the test output somewhere else, check that, and output your own TAP. See <http://search.cpan.org/src/ ADIE/Test-Class-0.28/t/skip2.t> for an example of that technique.

Cheers,

Adrian



Reply via email to