X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Flibtest-simple-perl%2Flibtest-simple-perl-0.80%2Ft%2Fbail_out.t;fp=dev%2Fi386%2Flibtest-simple-perl%2Flibtest-simple-perl-0.80%2Ft%2Fbail_out.t;h=d60c1509a4eb294f7d477bb43c3989deb4aee619;hp=0000000000000000000000000000000000000000;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hpb=df794b845212301ea0d267c919232538bfef356a diff --git a/dev/i386/libtest-simple-perl/libtest-simple-perl-0.80/t/bail_out.t b/dev/i386/libtest-simple-perl/libtest-simple-perl-0.80/t/bail_out.t new file mode 100644 index 0000000..d60c150 --- /dev/null +++ b/dev/i386/libtest-simple-perl/libtest-simple-perl-0.80/t/bail_out.t @@ -0,0 +1,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" );