root/Encode-DoubleEncodedUTF8/trunk/t/01_test.t

Revision 2162 (checked in by miyagawa, 13 years ago)

import

Line 
1 use strict;
2 use warnings;
3 use Test::Base;
4
5 use Encode;
6 use Encode::DoubleEncodedUTF8;
7
8
9 filters {
10     input => [ 'chomp', 'string' ],
11     expected => [ 'chomp', 'string' ]
12 };
13
14 sub string {
15     my $str = shift;
16     eval qq("$str");
17 }
18
19 plan tests => 1 * blocks;
20
21 run {
22     my $block = shift;
23     is decode("utf-8-de", $block->input), $block->expected;
24 }
25
26 __END__
27
28 === Unicode + UTF-8
29 --- input
30 \xe5\xae\xae\xc3\xa5\xc2\xae\xc2\xae
31 --- expected
32 \x{5bae}\x{5bae}
33
34 === Unicode + UTF-8 (double)
35 --- input
36 \xe5\xae\xae\xc3\xa5\xc2\xae\xc2\xae\xe5\xae\xae\xc3\xa5\xc2\xae\xc2\xae
37 --- expected
38 \x{5bae}\x{5bae}\x{5bae}\x{5bae}
39
40 === Dodgy Latin-1
41 --- input
42 Hello Léon
43 --- expected
44 Hello L\x{e9}on
45
46 === Safe latin-1
47 --- input
48 Hello Léon
49 --- expected
50 Hello L\x{e9}on
51
52 === Safe latin-1 + dodgy utf-8
53 --- input
54 Léon \xe5\xae\xae\xc3\xa5\xc2\xae\xc2\xae
55 --- expected
56 L\x{e9}on \x{5bae}\x{5bae}
Note: See TracBrowser for help on using the browser.