4 # This script is written intentionally in EUC-JP
8 if ($ENV{'PERL_CORE'}){
10 unshift @INC, '../lib';
12 require Config; import Config;
13 if ($Config{'extensions'} !~ /\bEncode\b/) {
14 print "1..0 # Skip: Encode was not built\n";
17 if (ord("A") == 193) {
18 print "1..0 # Skip: EBCDIC\n";
21 unless (PerlIO::Layer->find('perlio')){
22 print "1..0 # Skip: PerlIO required\n";
25 if ($ENV{PERL_CORE_MINITEST}) {
26 print "1..0 # Skip: no dynamic loading on miniperl, no Encode\n";
33 #use Test::More qw(no_plan);
34 use Test::More tests => 6;
36 use encoding 'euc-jp';
38 my @hiragana = map {chr} ord("¤¡")..ord("¤ó");
39 my @katakana = map {chr} ord("¥¡")..ord("¥ó");
40 my $hiragana = join('' => @hiragana);
41 my $katakana = join('' => @katakana);
42 my %h2k; @h2k{@hiragana} = @katakana;
43 my %k2h; @k2h{@katakana} = @hiragana;
45 # print @hiragana, "\n";
49 $str = $hiragana; $str =~ tr/¤¡-¤ó/¥¡-¥ó/;
50 is($str, $katakana, "tr// # hiragana -> katakana");
51 $str = $katakana; $str =~ tr/¥¡-¥ó/¤¡-¤ó/;
52 is($str, $hiragana, "tr// # hiragana -> katakana");
54 $str = $hiragana; eval qq(\$str =~ tr/¤¡-¤ó/¥¡-¥ó/);
55 is($str, $katakana, "eval qq(tr//) # hiragana -> katakana");
56 $str = $katakana; eval qq(\$str =~ tr/¥¡-¥ó/¤¡-¤ó/);
57 is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana");
59 $str = $hiragana; $str =~ s/([¤¡-¤ó])/$h2k{$1}/go;
60 is($str, $katakana, "s/// # hiragana -> katakana");
61 $str = $katakana; $str =~ s/([¥¡-¥ó])/$k2h{$1}/go;
62 is($str, $hiragana, "s/// # hiragana -> katakana");