8 plan skip_all => 'perl 5.8 required to test BAIL_OUT()' unless $] >= 5.008;
11 open my $memory_stream, '>', \$buf
12 or plan skip_all => 'could not create the in-memory file';
17 *CORE::GLOBAL::exit = *CORE::GLOBAL::exit = sub {
19 if ($caller eq 'Test::Leaner') {
30 eval { Test::Leaner::tap_stream($memory_stream) };
31 is $@, '', 'tap_stream($fh) does not croak';
37 seek $memory_stream, 0, 0;
38 eval { Test::Leaner::BAIL_OUT() };
39 is $@, '', 'BAIL_OUT() does not croak';
40 is $buf, "Bail out!\n", 'BAIL_OUT() produces the correct TAP code';
41 is $status, 255, 'BAIL_OUT() exits with the correct status';
47 seek $memory_stream, 0, 0;
48 eval { Test::Leaner::BAIL_OUT('this is a comment') };
49 is $@, '', 'BAIL_OUT("comment") does not croak';
50 is $buf, "Bail out! this is a comment\n",
51 'BAIL_OUT("comment") produces the correct TAP code';
52 is $status, 255, 'BAIL_OUT("comment") exits with the correct status';