4 if( $ENV{PERL_CORE} ) {
12 use Test::More tests => 5;
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 Test::Builder :)
24 $Test->todo_output(\*FAKEOUT);
26 diag("a single line");
31 diag("multiple\n", "lines");
32 push @lines, split(/\n/, $output);
35 is( @lines, 3, 'diag() should send messages to its filehandle' );
36 like( $lines[0], '/^#\s+/', ' should add comment mark to all lines' );
37 is( $lines[0], "# a single line\n", ' should send exact message' );
38 is( $output, "# multiple\n# lines\n", ' should append multi messages');
45 is( $output, "# # foo\n", "diag() adds a # even if there's one already" );
51 bless( $_[1], $_[0] );
56 $$self .= join('', @_);
61 if( $ENV{PERL_CORE} ) {
69 use Test::More tests => 5;
71 my $Test = Test::More->builder;
73 # now make a filehandle where we can send data
75 tie *FAKEOUT, 'FakeOut', \$output;
77 # force diagnostic output to a filehandle, glad I added this to Test::Builder :)
81 $Test->todo_output(\*FAKEOUT);
83 diag("a single line");
88 diag("multiple\n", "lines");
89 push @lines, split(/\n/, $output);
92 is( @lines, 3, 'diag() should send messages to its filehandle' );
93 like( $lines[0], '/^#\s+/', ' should add comment mark to all lines' );
94 is( $lines[0], "# a single line\n", ' should send exact message' );
95 is( $output, "# multiple\n# lines\n", ' should append multi messages');
102 is( $output, "# # foo\n", "diag() adds a # even if there's one already" );
108 bless( $_[1], $_[0] );
113 $$self .= join('', @_);