Move Test::Simple from lib to ext.
[p5sagit/p5-mst-13.2.git] / ext / Test-Simple / t / bail_out.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         chdir 't';
6         @INC = ('../lib', 'lib');
7     }
8     else {
9         unshift @INC, 't/lib';
10     }
11 }
12
13 my $Exit_Code;
14 BEGIN {
15     *CORE::GLOBAL::exit = sub { $Exit_Code = shift; };
16 }
17
18
19 use Test::Builder;
20 use Test::More;
21
22 my $output;
23 my $TB = Test::More->builder;
24 $TB->output(\$output);
25
26 my $Test = Test::Builder->create;
27 $Test->level(0);
28
29 $Test->plan(tests => 3);
30
31 plan tests => 4;
32
33 BAIL_OUT("ROCKS FALL! EVERYONE DIES!");
34
35
36 $Test->is_eq( $output, <<'OUT' );
37 1..4
38 Bail out!  ROCKS FALL! EVERYONE DIES!
39 OUT
40
41 $Test->is_eq( $Exit_Code, 255 );
42
43 $Test->ok( $Test->can("BAILOUT"), "Backwards compat" );