xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Harness/t/nested.t (revision 6fb12b7054efc6b436584db6cef9c2f85c0d7e27)
1#!/usr/bin/perl -wT
2
3use strict;
4use warnings;
5use lib 't/lib';
6
7use Test::More tests => 5;
8
9use TAP::Parser;
10
11my $tap = <<'END_TAP';
121..2
13ok 1 - input file opened
14... this is junk
15    Bail out!  We ran out of foobar.
16END_TAP
17my $parser = TAP::Parser->new( { tap => $tap } );
18isa_ok $parser, 'TAP::Parser',
19  '... we should be able to parse bailed out tests';
20
21my @results;
22while ( my $result = $parser->next ) {
23    push @results => $result;
24}
25my $bailout = pop @results;
26ok $bailout->is_bailout, 'We should be able to parse a nested bailout';
27is $bailout->as_string,  'We ran out of foobar.',
28  '... and as_string() should return the explanation';
29is $bailout->raw, '    Bail out!  We ran out of foobar.',
30  '... and raw() should return the explanation';
31is $bailout->explanation, 'We ran out of foobar.',
32  '... and it should have the correct explanation';
33