Upgrade to Test-Harness-3.17
[p5sagit/p5-mst-13.2.git] / ext / Test-Harness / t / parse.t
index 4bcaba3..942c178 100644 (file)
@@ -12,7 +12,7 @@ BEGIN {
     }
 }
 
-use Test::More tests => 282;
+use Test::More tests => 294;
 use IO::c55Capture;
 
 use File::Spec;
@@ -438,6 +438,30 @@ is $test->raw, 'ok 2 - read the rest of the file',
 is scalar $parser->passed, 2,
   'Empty junk lines should not affect the correct number of tests passed';
 
+# Check source => "tap content"
+can_ok $PARSER, 'new';
+$parser = $PARSER->new( { source => "1..1\nok 1\n" } );
+isa_ok $parser, $PARSER, '... and calling it should succeed';
+ok @results = _get_results($parser), 'The parser should return results';
+is( scalar @results, 2, "Got two lines of TAP" );
+
+# Check source => [array]
+can_ok $PARSER, 'new';
+$parser = $PARSER->new( { source => [ "1..1", "ok 1" ] } );
+isa_ok $parser, $PARSER, '... and calling it should succeed';
+ok @results = _get_results($parser), 'The parser should return results';
+is( scalar @results, 2, "Got two lines of TAP" );
+
+# Check source => $filehandle
+can_ok $PARSER, 'new';
+open my $fh, $ENV{PERL_CORE}
+  ? '../ext/Test-Harness/t/data/catme.1'
+  : 't/data/catme.1';
+$parser = $PARSER->new( { source => $fh } );
+isa_ok $parser, $PARSER, '... and calling it should succeed';
+ok @results = _get_results($parser), 'The parser should return results';
+is( scalar @results, 2, "Got two lines of TAP" );
+
 {
 
     # set a spool to write to