4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
15 # Can't use Test.pm, that's a 5.005 thing.
19 # Utility testing functions.
21 my($test, $name) = @_;
23 $ok .= "not " unless $test;
24 $ok .= "ok $test_num";
25 $ok .= " - $name" if defined $name;
35 my $Test = Test::Builder->new();
38 my $tmpfile = 'foo.tmp';
39 my $out = $Test->output($tmpfile);
40 END { unlink($tmpfile) }
48 open(IN, $tmpfile) or die $!;
49 chomp(my $line = <IN>);
54 open(FOO, ">>$tmpfile") or die $!;
55 $out = $Test->output(\*FOO);
61 open(IN, $tmpfile) or die $!;
65 ok($lines[1] =~ /Hello!/);
69 # Ensure stray newline in name escaping works.
70 $out = tie *FAKEOUT, 'TieOut';
71 $Test->output(\*FAKEOUT);
72 $Test->exported_to(__PACKAGE__);
74 $Test->plan(tests => 5);
78 $Test->ok(1, "ok, like\nok");
79 $Test->skip("wibble\nmoof");
80 $Test->todo_skip("todo\nskip\n");
82 my $output = $out->read;
83 ok( $output eq <<OUTPUT ) || print STDERR $output;
92 not ok 5 # TODO & SKIP todo