2 # $Id: /mirror/googlecode/test-more/t/diag.t 57943 2008-08-18T02:09:22.275428Z brooklyn.kid51 $
5 if( $ENV{PERL_CORE} ) {
7 @INC = ('../lib', 'lib');
10 unshift @INC, 't/lib';
15 # Turn on threads here, if available, since this test tends to find
16 # lots of threading bugs.
19 if( $] >= 5.008001 && $Config{useithreads} ) {
28 use Test::More tests => 5;
30 my $Test = Test::More->builder;
32 # now make a filehandle where we can send data
34 my $output = tie *FAKEOUT, 'TieOut';
36 # force diagnostic output to a filehandle, glad I added this to
41 $Test->todo_output(\*FAKEOUT);
43 diag("a single line");
45 $ret = diag("multiple\n", "lines");
48 is( $output->read, <<'DIAG', 'diag() with todo_output set' );
54 ok( !$ret, 'diag returns false' );
57 $Test->failure_output(\*FAKEOUT);
60 $Test->failure_output(\*STDERR);
61 is( $output->read, "# # foo\n", "diag() adds # even if there's one already" );
62 ok( !$ret, 'diag returns false' );
67 $Test->failure_output(\*FAKEOUT);
70 $Test->failure_output(\*STDERR);
71 is( $output->read, <<'DIAG' );