4 if( $ENV{PERL_CORE} ) {
12 use Test::More tests => 7;
14 my $Test = Test::More->builder;
16 # now make a filehandle where we can send data
18 tie *FAKEOUT, 'FakeOut', \$output;
20 # force diagnostic output to a filehandle, glad I added this to
26 $Test->todo_output(\*FAKEOUT);
28 diag("a single line");
33 $ret = diag("multiple\n", "lines");
34 push @lines, split(/\n/, $output);
37 is( @lines, 3, 'diag() should send messages to its filehandle' );
38 like( $lines[0], '/^#\s+/', ' should add comment mark to all lines' );
39 is( $lines[0], "# a single line\n", ' should send exact message' );
40 is( $output, "# multiple\n# lines\n", ' should append multi messages');
41 ok( !$ret, 'diag returns false' );
44 $Test->failure_output(\*FAKEOUT);
48 $Test->failure_output(\*STDERR);
49 is( $output, "# # foo\n", "diag() adds a # even if there's one already" );
50 ok( !$ret, 'diag returns false' );
55 bless( $_[1], $_[0] );
60 $$self .= join('', @_);