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";
29 #use Test::More qw(no_plan);
30 use Test::More tests => 6;
32 use encoding 'euc-jp';
34 my @hiragana = map {chr} ord("¤¡")..ord("¤ó");
35 my @katakana = map {chr} ord("¥¡")..ord("¥ó");
36 my $hiragana = join('' => @hiragana);
37 my $katakana = join('' => @katakana);
38 my %h2k; @h2k{@hiragana} = @katakana;
39 my %k2h; @k2h{@katakana} = @hiragana;
41 # print @hiragana, "\n";
45 $str = $hiragana; $str =~ tr/¤¡-¤ó/¥¡-¥ó/;
46 is($str, $katakana, "tr// # hiragana -> katakana");
47 $str = $katakana; $str =~ tr/¥¡-¥ó/¤¡-¤ó/;
48 is($str, $hiragana, "tr// # hiragana -> katakana");
50 $str = $hiragana; eval qq(\$str =~ tr/¤¡-¤ó/¥¡-¥ó/);
51 is($str, $katakana, "eval qq(tr//) # hiragana -> katakana");
52 $str = $katakana; eval qq(\$str =~ tr/¥¡-¥ó/¤¡-¤ó/);
53 is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana");
55 $str = $hiragana; $str =~ s/([¤¡-¤ó])/$h2k{$1}/go;
56 is($str, $katakana, "s/// # hiragana -> katakana");
57 $str = $katakana; $str =~ s/([¥¡-¥ó])/$k2h{$1}/go;
58 is($str, $hiragana, "s/// # hiragana -> katakana");