4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
14 # Turn on threads here, if available, since this test tends to find
15 # lots of threading bugs.
18 if( $] >= 5.008001 && $Config{useithreads} ) {
27 use Test::Builder::NoOutput;
28 use Test::More tests => 7;
30 my $test = Test::Builder::NoOutput->create;
32 # Test diag() goes to todo_output() in a todo test.
36 $test->diag("a single line");
37 is( $test->read('todo'), <<'DIAG', 'diag() with todo_output set' );
41 my $ret = $test->diag("multiple\n", "lines");
42 is( $test->read('todo'), <<'DIAG', ' multi line' );
46 ok( !$ret, 'diag returns false' );
52 # Test diagnostic formatting
55 is( $test->read('err'), "# # foo\n", "diag() adds # even if there's one already" );
57 $test->diag("foo\n\nbar");
58 is( $test->read('err'), <<'DIAG', " blank lines get escaped" );
64 $test->diag("foo\n\nbar\n\n");
65 is( $test->read('err'), <<'DIAG', " even at the end" );
74 # [rt.cpan.org 8392] diag(@list) emulates print
76 $test->diag(qw(one two));
78 is( $test->read('err'), <<'DIAG' );