Debian Codegraph @

dist/Locale-Maketext/t/91_backslash.t

raw
1 #!/usr/bin/perl -Tw
2
3 use strict;
4 use Test::More tests => 6;
5
6 BEGIN {
7 use_ok( 'Locale::Maketext' );
8 }
9
10 use utf8;
11
12 {
13 package My::Localize;
14 our @ISA = ('Locale::Maketext');
15 }
16 {
17 package My::Localize::cs_cz;
18 our @ISA = ('My::Localize');
19 our %Lexicon = (
20 '[_1]foo1\n' => '[_1]bar\n',
21 '[_1]foo2\n' => '[_1]běr\n',
22 'foo2\n' => 'aěa\n',
23 "[_1]foo\\n\n" => "[_1]bar\\n\n",
24 );
25 keys %Lexicon; # dodges the 'used only once' warning
26 }
27
28 my $lh = My::Localize->get_handle('cs_cz');
29 isa_ok( $lh, 'My::Localize::cs_cz' );
30 is( $lh->maketext('[_1]foo1\n', 'arg'), 'argbar\n', 'Safe parameterized' );
31 is( $lh->maketext('[_1]foo2\n', 'arg'), 'argběr\n', 'Unicode parameterized' );
32 is( $lh->maketext('foo2\n'), 'aěa\n', 'Unicode literal' );
33 is( $lh->maketext("[_1]foo\\n\n", 'arg'), "argbar\\n\n", 'new line parameterized' );