Commit 0a5fd0aa authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Encode characters on their way out of tests

Tests may produce characters (e.g. ok(1, "¡Oy!") ) which need to be
encoded before being output.  Use the suggested technique from the
Test::More POD to encode these strings.
parent bc8e5e94
......@@ -172,6 +172,8 @@ sub import {
$class->set_config_wrapper;
$class->encode_output;
my $screen_logger = $RT::Logger->remove( 'screen' );
require Log::Dispatch::Perl;
$RT::Logger->add( Log::Dispatch::Perl->new
......@@ -454,6 +456,13 @@ sub set_config_wrapper {
};
}
sub encode_output {
my $builder = Test::More->builder;
binmode $builder->output, ":encoding(utf8)";
binmode $builder->failure_output, ":encoding(utf8)";
binmode $builder->todo_output, ":encoding(utf8)";
}
sub bootstrap_db {
my $self = shift;
my %args = @_;
......
......@@ -113,7 +113,7 @@ for my $encoding ('ISO-8859-1', 'UTF-8') {
my $encoded_subject = $mail[0]->head->get("Subject");
chomp $encoded_subject;
my $subject = Encode::decode('MIME-Header',$encoded_subject);
like($subject, qr/Niv\x{e5}er/, Encode::encode("UTF-8", "The subject matches the word - $subject"));
like($subject, qr/Niv\x{e5}er/, "The subject matches the word - $subject");
}
{
......
......@@ -124,7 +124,7 @@ for my $encoding ('ISO-8859-1', 'UTF-8') {
my $encoded_subject = $mail[0]->head->get("Subject");
chomp $encoded_subject;
my $subject = Encode::decode('MIME-Header',$encoded_subject);
like($subject, qr/Niv\x{e5}er/, Encode::encode("UTF-8", "The subject matches the word - $subject"));
like($subject, qr/Niv\x{e5}er/, "The subject matches the word - $subject");
}
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment