Locale-TextDomain-OO-Util
view release on metacpan or search on metacpan
t/02_join_split.t view on Meta::CPAN
}),
"my singular\x00my plural\x04my context",
'join message key';
eq_or_diff
$key_util->split_message_key("my singular\x00my plural\x04my context"),
{
msgctxt => 'my context',
msgid => 'my singular',
msgid_plural => 'my plural',
},
'split message key';
}
MESSAGE_KEY_JSON: {
is
$key_util->join_message_key(undef, 'JSON'),
q{},
'join empty JSON message key';
eq_or_diff
$key_util->split_message_key(undef, 'JSON'),
{},
t/02_join_split.t view on Meta::CPAN
reference => { 'dir/file:123' => undef },
})
],
[
"my singular\x00my plural\04my context",
{
msgstr_plural => [ 'tr singular', 'tr plural' ],
reference => { 'dir/file:123' => undef },
},
],
'split message';
}
MESSAGE_JSON: {
eq_or_diff
$key_util->join_message(undef, undef, 'JSON'),
{ msgid => q{} },
'join empty JSON message';
eq_or_diff
[ $key_util->split_message(undef, 'JSON') ],
[ q{}, {} ],
{
open my $file, '< :raw', $file_name
or die "Cannnot open file $file_name";
local $/ = ();
my $text = <$file>;
# repair last line without \n
ok(
! ( $text =~ s{([^\x0D\x0A]) \z}{$1\x0D\x0A}xms ),
"$file_name has newline at EOF",
);
@lines = split m{\x0A}, $text;
}
my $find_line_numbers = sub {
my ($test_description, $test_reason, $regex, $regex_negation) = @_;
my $line_number = 0;
my @line_numbers = map {
++$line_number;
($regex_negation xor $_ =~ $regex)
? $line_number
: ();
( run in 0.482 second using v1.01-cache-2.11-cpan-71847e10f99 )