1#!perl -w
2# HARNESS-NO-STREAM
3# HARNESS-NO-PRELOAD
4
5BEGIN {
6    if( $ENV{PERL_CORE} ) {
7        chdir 't';
8        @INC = '../lib';
9    }
10}
11
12# Can't use Test.pm, that's a 5.005 thing.
13package My::Test;
14
15# This has to be a require or else the END block below runs before
16# Test::Builder's own and the ending diagnostics don't come out right.
17require Test::Builder;
18my $TB = Test::Builder->create;
19$TB->plan(tests => 3);
20
21
22package main;
23
24require Test::Simple;
25
26chdir 't';
27push @INC, '../t/lib/';
28require Test::Simple::Catch;
29my($out, $err) = Test::Simple::Catch::caught();
30local $ENV{HARNESS_ACTIVE} = 0;
31
32Test::Simple->import(tests => 1);
33exit 250;
34
35END {
36    $TB->is_eq($out->read, <<OUT);
371..1
38OUT
39
40    $TB->is_eq($err->read, <<ERR);
41# Looks like your test exited with 250 before it could output anything.
42ERR
43
44    $TB->is_eq($?, 250, "exit code");
45
46    $? = grep { !$_ } $TB->summary;
47}
48