Blame t/message-decode-xml.t

Packit a09cf7
# https://rt.cpan.org/Public/Bug/Display.html?id=52572
Packit a09cf7
Packit a09cf7
use strict;
Packit a09cf7
use warnings;
Packit a09cf7
Packit a09cf7
use Test::More;
Packit a09cf7
plan tests => 2;
Packit a09cf7
Packit a09cf7
use Encode           qw( encode );
Packit a09cf7
use HTTP::Headers    qw( );
Packit a09cf7
use HTTP::Response   qw( );
Packit a09cf7
use PerlIO::encoding qw( );
Packit a09cf7
Packit a09cf7
{
Packit a09cf7
    my $builder = Test::More->builder;
Packit a09cf7
    local $PerlIO::encoding::fallback = Encode::PERLQQ();
Packit a09cf7
    binmode $builder->output,         ":encoding(US-ASCII)";
Packit a09cf7
    binmode $builder->failure_output, ":encoding(US-ASCII)";
Packit a09cf7
    binmode $builder->todo_output,    ":encoding(US-ASCII)";
Packit a09cf7
}
Packit a09cf7
Packit a09cf7
for my $enc (qw( UTF-8 UTF-16le )) {
Packit a09cf7
    my $file = encode($enc,
Packit a09cf7
	($enc =~ /^UTF-/ ? "\x{FEFF}" : "") .
Packit a09cf7
	qq{\n} .
Packit a09cf7
	qq{<root>\x{C9}ric</root>\n}
Packit a09cf7
    );
Packit a09cf7
Packit a09cf7
    my $headers = HTTP::Headers->new(Content_Type => "application/xml");
Packit a09cf7
    my $response = HTTP::Response->new(200, "OK", $headers, $file);
Packit a09cf7
Packit a09cf7
    is($response->decoded_content, qq(\n<root>\x{c9}ric</root>\n), $enc);
Packit a09cf7
}