in reply to Re: TAP question
in thread TAP question

Interesting idea. This could work. I can't make any mods to the existing .t files to make them provide a return value since I don't own them, but I could manually parse the output stream looking for "not ok", and if found, trigger a failure for the entire file. Thanks!

Replies are listed 'Best First'.
Re^3: TAP question
by ysth (Canon) on Feb 26, 2008 at 20:54 UTC
    I wasn't suggesting manually parsing them. If you just look for "not ok", for instance, you lose the ability to have TODO tests. I was suggesting having a single .t file that uses TAP::Harness to run the existing .t files and give a per-file ok or not ok result (that your outer framework interprets).
      Hmm I guess I'm confused then. The only way I've generated TAP in the past is by using Test:More either ok() or is() or something to test values. Given that the existing .t files don't return predictable values, the only thing I could test for would be the TAP output that the test cases contained within are producing.

      How would running all of the .t files using TAP::Harness from within a .t file, rather than from the main script give me any different output?

      The only way I can imagine getting a different output would be to run it something like this:

      set SDTOUT to a file for each .t file run .t parse output file for each line do either: is(1,1,testcasename) or is(1,0,testcasename) next file

      What is is that you're suggesting?

        Something like this:
        use strict; use warnings; use Test::More; use TAP::Harness; my $harness = TAP::Harness->new({verbosity => -9}); my $agg_results = $harness->runtests(glob "suite_foo/*.t"); my @tests = $agg_results->descriptions; plan(tests => scalar(@tests)); for my $test (@tests) { my ($parser) = $agg_results->parsers($test); ok(! $parser->has_problems, $test); }
        Note that the new TAP::* modules have some documentation infelicities: TAP::Parser's has_problems says it complains about passed TODO tests but it doesn't (and shouldn't), and TAP::Harness verbosity < -2 (silent) isn't documented.