2 # $Id: /mirror/googlecode/test-more/t/bail_out.t 57943 2008-08-18T02:09:22.275428Z brooklyn.kid51 $
5 if( $ENV{PERL_CORE} ) {
7 @INC = ('../lib', 'lib');
10 unshift @INC, 't/lib';
16 *CORE::GLOBAL::exit = sub { $Exit_Code = shift; };
24 my $output = tie *FAKEOUT, 'TieOut';
25 my $TB = Test::More->builder;
26 $TB->output(\*FAKEOUT);
28 my $Test = Test::Builder->create;
32 $Test->plan(tests => 3);
35 $Test->plan(skip_all =>
36 'CORE::GLOBAL::exit, introduced in 5.005, is needed for testing');
42 BAIL_OUT("ROCKS FALL! EVERYONE DIES!");
45 $Test->is_eq( $output->read, <<'OUT' );
47 Bail out! ROCKS FALL! EVERYONE DIES!
50 $Test->is_eq( $Exit_Code, 255 );
52 $Test->ok( $Test->can("BAILOUT"), "Backwards compat" );