Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Monday June 08, 2009
08:57 AM

Pseudo-code For Rewriting TAP Streams

[ #39098 ]

Another team has an issue where they have multiple TAP streams which all need to be integrated into a single stream, but obviously concatenating them won't do the trick. It would fail because you can't have more than one plan in a stream and the test numbers would be out of sequence (though you can turn them off if you're using Test::Builder). In talking with one of their developers, I wrote the following pseudo-code to explain the basic concept.

#!/usr/bin/env perl

use strict;
use warnings;

use TAP::Parser;

my $test_num = 1;
foreach my $stream (get_streams()) {
    my $parser = TAP::Parser->new($stream);
    while ( my $result = $parser->next ) {
        if ( $result->is_plan ) {

            # sent to STDOUT to ensure proper synchronization
            print '# '.$result->as_string;
        }
        next unless $result->is_test;
        print $result->ok;
        print $test_num++;
        # don't forget SKIP and TODO
        print ' - ',$result->description,$/;
    }
    # check to see if the parser succeeded
}
print "1..$test_num\n";

sub get_streams {
    ...
}

When we get nested TAP, ugly hacks like this will go away.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.