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