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 => 7;
30 my $test = Test::Builder->create;
32 # now make a filehandle where we can send data
34 my $output = tie *FAKEOUT, 'TieOut';
37 # Test diag() goes to todo_output() in a todo test.
40 $test->todo_output(\*FAKEOUT);
42 $test->diag("a single line");
43 is( $output->read, <<'DIAG', 'diag() with todo_output set' );
47 my $ret = $test->diag("multiple\n", "lines");
48 is( $output->read, <<'DIAG', ' multi line' );
52 ok( !$ret, 'diag returns false' );
57 $test->reset_outputs();
60 # Test diagnostic formatting
61 $test->failure_output(\*FAKEOUT);
64 is( $output->read, "# # foo\n", "diag() adds # even if there's one already" );
66 $test->diag("foo\n\nbar");
67 is( $output->read, <<'DIAG', " blank lines get escaped" );
74 $test->diag("foo\n\nbar\n\n");
75 is( $output->read, <<'DIAG', " even at the end" );
86 $test->diag(qw(one two));
88 is( $output->read, <<'DIAG' );