Clear up test based on line number differences between the core and the
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / bail_out.t
CommitLineData
b1ddf169 1#!/usr/bin/perl -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't';
6 @INC = ('../lib', 'lib');
7 }
8 else {
9 unshift @INC, 't/lib';
10 }
11}
12
13my $Exit_Code;
14BEGIN {
15 *CORE::GLOBAL::exit = sub { $Exit_Code = shift; };
16}
17
18
19use Test::Builder;
20use Test::More;
21use TieOut;
22
23my $output = tie *FAKEOUT, 'TieOut';
24my $TB = Test::More->builder;
25$TB->output(\*FAKEOUT);
26
27my $Test = Test::Builder->create;
28$Test->level(0);
29
30if( $] >= 5.005 ) {
845d7e37 31 $Test->plan(tests => 3);
b1ddf169 32}
33else {
34 $Test->plan(skip_all =>
35 'CORE::GLOBAL::exit, introduced in 5.005, is needed for testing');
36}
37
38
39plan tests => 4;
40
41BAIL_OUT("ROCKS FALL! EVERYONE DIES!");
42
43
44$Test->is_eq( $output->read, <<'OUT' );
451..4
46Bail out! ROCKS FALL! EVERYONE DIES!
47OUT
48
49$Test->is_eq( $Exit_Code, 255 );
845d7e37 50
51$Test->ok( $Test->can("BAILOUT"), "Backwards compat" );