1*b39c5158Smillert
2*b39c5158Smillertuse Test::More;
3*b39c5158Smillert
4*b39c5158SmillertBEGIN {
5*b39c5158Smillert    if( ord("A") == 193 ) {
6*b39c5158Smillert	plan skip_all => 'No Encode::MIME::Header::ISO_2022_JP on EBCDIC Platforms';
7*b39c5158Smillert    } else {
8*b39c5158Smillert	plan tests => 14;
9*b39c5158Smillert    }
10*b39c5158Smillert}
11*b39c5158Smillert
12*b39c5158Smillertuse strict;
13*b39c5158Smillertuse Encode;
14*b39c5158Smillert
15*b39c5158SmillertBEGIN{
16*b39c5158Smillert    use_ok('Encode::MIME::Header::ISO_2022_JP');
17*b39c5158Smillert}
18*b39c5158Smillert
19*b39c5158Smillertrequire_ok('Encode::MIME::Header::ISO_2022_JP');
20*b39c5158Smillert
21*b39c5158Smillert#  below codes are from mime.t in Jcode
22*b39c5158Smillert
23*b39c5158Smillertmy %mime = (
24*b39c5158Smillert    "�������������ʡ��Ҥ餬��"
25*b39c5158Smillert     => "=?ISO-2022-JP?B?GyRCNEE7eiEiJSslPyUrJUohIiRSJGkkLCRKGyhC?=",
26*b39c5158Smillert    "foo bar"
27*b39c5158Smillert     => "foo bar",
28*b39c5158Smillert    "�������������ʡ��Ҥ餬�ʤκ����ä�Subject Header."
29*b39c5158Smillert     => "=?ISO-2022-JP?B?GyRCNEE7eiEiJSslPyUrJUohIiRSJGkkLCRKJE46LiQ4JEMkPxsoQlN1?=\n =?ISO-2022-JP?B?YmplY3Q=?= Header.",
30*b39c5158Smillert);
31*b39c5158Smillert
32*b39c5158Smillert
33*b39c5158Smillertfor my $k (keys %mime){
34*b39c5158Smillert    $mime{"$k\n"} = $mime{$k} . "\n";
35*b39c5158Smillert}
36*b39c5158Smillert
37*b39c5158Smillert
38*b39c5158Smillertfor my $decoded (sort keys %mime){
39*b39c5158Smillert    my $encoded = $mime{$decoded};
40*b39c5158Smillert
41*b39c5158Smillert    my $header = Encode::encode('MIME-Header-ISO_2022_JP', decode('euc-jp', $decoded));
42*b39c5158Smillert    my $utf8   = Encode::decode('MIME-Header', $header);
43*b39c5158Smillert
44*b39c5158Smillert    is(encode('euc-jp', $utf8), $decoded);
45*b39c5158Smillert    is($header, $encoded);
46*b39c5158Smillert}
47*b39c5158Smillert
48*b39c5158Smillert__END__
49