4 if( $ENV{PERL_CORE} ) {
11 # Turn on threads here, if available, since this test tends to find
12 # lots of threading bugs.
15 if( $] >= 5.008 && $Config{useithreads} ) {
24 use Test::More tests => 7;
26 my $Test = Test::More->builder;
28 # now make a filehandle where we can send data
30 tie *FAKEOUT, 'FakeOut', \$output;
32 # force diagnostic output to a filehandle, glad I added this to
38 $Test->todo_output(\*FAKEOUT);
40 diag("a single line");
45 $ret = diag("multiple\n", "lines");
46 push @lines, split(/\n/, $output);
49 is( @lines, 3, 'diag() should send messages to its filehandle' );
50 like( $lines[0], '/^#\s+/', ' should add comment mark to all lines' );
51 is( $lines[0], "# a single line\n", ' should send exact message' );
52 is( $output, "# multiple\n# lines\n", ' should append multi messages');
53 ok( !$ret, 'diag returns false' );
56 $Test->failure_output(\*FAKEOUT);
60 $Test->failure_output(\*STDERR);
61 is( $output, "# # foo\n", "diag() adds a # even if there's one already" );
62 ok( !$ret, 'diag returns false' );
67 bless( $_[1], $_[0] );
72 $$self .= join('', @_);