Locale-MO-File
view release on metacpan or search on metacpan
t/14_big_endian_utf-8.t view on Meta::CPAN
#!perl -T
use strict;
use warnings;
use charnames ':full';
use Carp qw(confess);
use English qw(-no_match_vars $OS_ERROR $INPUT_RECORD_SEPARATOR);
use Hash::Util qw(lock_hash);
use IO::File qw(SEEK_SET);
use Test::More tests => 10;
use Test::NoWarnings;
use Test::Differences;
use Test::Exception;
use Test::HexDifferences;
BEGIN {
require_ok 'Locale::MO::File';
}
my $CRLF = "\r\n";
my @messages = (
{
msgid => q{},
msgstr => <<'EOT',
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Plural-Forms: nplurals=2; plural=n != 1
EOT
},
{
msgid => "11\N{LATIN SMALL LETTER E WITH DIAERESIS}",
msgstr => "12\N{LATIN SMALL LETTER U WITH DIAERESIS}",
},
{
msgctxt => "21\N{LATIN SMALL LETTER A WITH DIAERESIS}",
msgid => "22\N{LATIN SMALL LETTER E WITH DIAERESIS}",
msgstr => "23\N{LATIN SMALL LETTER U WITH DIAERESIS}",
},
{
msgid => "31\N{LATIN SMALL LETTER E WITH DIAERESIS}",
msgid_plural => "32\N{LATIN SMALL LETTER O WITH DIAERESIS}",
msgstr_plural => [
"33\N{LATIN SMALL LETTER U WITH DIAERESIS}",
"34\N{LATIN SMALL LETTER U WITH DIAERESIS}",
],
},
{
msgctxt => "41\N{LATIN SMALL LETTER A WITH DIAERESIS}",
msgid => "42\N{LATIN SMALL LETTER E WITH DIAERESIS}",
msgid_plural => "43\N{LATIN SMALL LETTER O WITH DIAERESIS}",
msgstr_plural => [
"44\N{LATIN SMALL LETTER U WITH DIAERESIS}",
"45\N{LATIN SMALL LETTER U WITH DIAERESIS}",
],
},
);
for my $message (@messages) {
lock_hash %{$message};
}
my $filename = '14_big_endian_utf-8.mo';
my @sorted_messages = (
map {
$_->[0];
}
sort {
$a->[1] cmp $b->[1];
}
map {
[
$_,
Locale::MO::File->new(filename => $filename)->_pack_message($_)->{msgid},
( run in 1.398 second using v1.01-cache-2.11-cpan-99c4e6809bf )