Created
January 21, 2016 00:53
-
-
Save harschware/baec4c05de8e700924ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Produces output found at the end of this script / after __END__ | |
use TAP::Parser; | |
my $NO_DESC = <<EOF; | |
1..1 | |
ok 1 # skip for a really good reason | |
EOF | |
my $HAS_DESC = <<EOF; | |
1..1 | |
ok 1 skip test with a reason # skip for a really good reason | |
EOF | |
print "#### Experiment #1 - Test a skipped test with no description ####\n"; | |
print "$NO_DESC\n\n"; | |
parseTest( $NO_DESC ); | |
print "#### Experiment #2 - Test a skipped test with description ####\n"; | |
print "$HAS_DESC\n\n"; | |
parseTest( $HAS_DESC ); | |
sub parseTest( $ ) { | |
my $tap = shift or die; | |
my $parser = TAP::Parser->new( { tap => $tap } ); | |
while ( my $result = $parser->next ) { | |
# warn $result->as_string . "\n"; | |
if( $result->isa('TAP::Parser::Result::Test') ) { | |
my $number = $result->number; | |
my $description = $result->description; | |
warn "\$number = \"$number\""; | |
warn "\$description = \"$description\""; | |
if( $result->has_skip ) { | |
my $explanation = $result->explanation; | |
warn "This test was SKIPPED! Explanation=\"$explanation\""; | |
} # end if | |
} # end if | |
} # end while | |
} # end sub | |
__END__ | |
#### Experiment #1 - Test a skipped test with no description #### | |
1..1 | |
ok 1 # skip for a really good reason | |
$number = "1" at parseTests.pl line 34. | |
$description = "" at parseTests.pl line 35. | |
This test was SKIPPED! Explanation="for a really good reason" at parseTests.pl line 38. | |
#### Experiment #2 - Test a skipped test with description #### | |
1..1 | |
ok 1 skip test with a reason # skip for a really good reason | |
$number = "1" at parseTests.pl line 34. | |
$description = "skip test with a reason" at parseTests.pl line 35. | |
This test was SKIPPED! Explanation="for a really good reason" at parseTests.pl line 38. | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment