1 |
wakaba |
1.1 |
#!/usr/bin/perl -w |
2 |
|
|
## -*- euc-japan -*- |
3 |
|
|
use strict; |
4 |
|
|
|
5 |
|
|
use Test; |
6 |
|
|
require Message::Util; |
7 |
|
|
|
8 |
|
|
my (%test); |
9 |
|
|
|
10 |
|
|
%test = ( |
11 |
|
|
"(180)(193)(187)(250)(161)(162)(165)(171)(165)(191)(165)(171)(165)(202)(161)(162)(164)(210)(164)(233)(164)(172)(164)(202)" |
12 |
|
|
=> ['decoding 8bit printable-string' => sub { Message::Util::encode_printable_string ( |
13 |
|
|
"漢字、カタカナ、ひらがな" |
14 |
|
|
) }], |
15 |
|
|
"'a demo.'" |
16 |
|
|
=> ['decoding no-encoded printable-string' => sub { Message::Util::decode_printable_string ( |
17 |
|
|
"'a demo.'" |
18 |
|
|
) }], |
19 |
|
|
"a demo." |
20 |
|
|
=> ['encoding printable-string' => sub { Message::Util::encode_printable_string ( |
21 |
|
|
"a demo." |
22 |
|
|
) }], |
23 |
|
|
q{foo(a)bar.example} |
24 |
|
|
=> ['encoding printable-string' => sub { Message::Util::encode_printable_string ( |
25 |
|
|
q{foo@bar.example} |
26 |
|
|
) }], |
27 |
|
|
q{foo@bar.example} |
28 |
|
|
=> ['decoding printable-string' => sub { Message::Util::decode_printable_string ( |
29 |
|
|
q{foo(A)bar.example} |
30 |
|
|
) }], |
31 |
|
|
q{(q)(u)(p)(q)(126)} |
32 |
|
|
=> ['encoding printable-string' => sub { Message::Util::encode_printable_string ( |
33 |
|
|
q{"_%"~} |
34 |
|
|
) }], |
35 |
|
|
q{"_%"(} |
36 |
|
|
=> ['decoding printable-string' => sub { Message::Util::decode_printable_string ( |
37 |
|
|
q{(q)(u)(p)(q)(} |
38 |
|
|
) }], |
39 |
|
|
q{aou(vvv)v{dfda}ddd} |
40 |
|
|
=> ['decoding T.61String' => sub { Message::Util::decode_t61_string ( |
41 |
|
|
q{aou{040}vvv{041}v{123}dfda{125}ddd} |
42 |
|
|
) }], |
43 |
|
|
q{Aidfo{064}bar.example} |
44 |
|
|
=> ['encoding T.61String' => sub { Message::Util::encode_t61_string ( |
45 |
|
|
q{Aidfo@bar.example} |
46 |
|
|
) }], |
47 |
|
|
q{dd(d)v)(%)aaieu} |
48 |
|
|
=> ['decoding T.61String' => sub { Message::Util::decode_t61_string ( |
49 |
|
|
q{dd{040}d{041}v{041040037041}aaieu} |
50 |
|
|
) }], |
51 |
|
|
q{argle#~} |
52 |
|
|
=> ['decoding restricted RFC 822' => sub { Message::Util::decode_restricted_rfc822 ( |
53 |
|
|
q{argle#h##126#} |
54 |
|
|
) }], |
55 |
|
|
q{Steve_Kille} |
56 |
|
|
=> ['encoding restricted RFC 822' => sub { Message::Util::encode_restricted_rfc822 ( |
57 |
|
|
q{Steve Kille} |
58 |
|
|
) }], |
59 |
|
|
); |
60 |
|
|
plan tests => 0 + keys (%test); |
61 |
|
|
|
62 |
|
|
for (keys %test) { |
63 |
|
|
ok (&{ $test{$_}->[1] }, $_, $test{$_}->[0].' is broken'); |
64 |
|
|
} |