use utf8;
use strict;
use warnings;
use Test::More;
use Encode;
use Term::Encoding qw(term_encoding);
my $charset = term_encoding;
{
no warnings 'redefine';
sub Test::Builder::_print_to_fh {
my( $self, $fh, @msgs ) = @_;
# Prevent printing headers when only compiling. Mostly for when
# tests are deparsed with B::Deparse
return if $^C;
my $msg = join '', @msgs;
my $indent = $self->_indent;
local( $\, $", $, ) = ( undef, ' ', '' );
# Escape each line after the first with a # so we don't
# confuse Test::Harness.
$msg =~ s{\n(?!\z)}{\n$indent# }sg;
# Stick a newline on the end if it needs it.
$msg .= "\n" unless $msg =~ /\n\z/;
return print $fh $indent, encode($charset, $msg);
}
}
... # テストを書く
Comments
comments powered by Disqus