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