t/uni/lower.t See if Unicode casing works
t/uni/sprintf.t See if Unicode sprintf works
t/uni/title.t See if Unicode casing works
+t/uni/tr_7jis.t See if Unicode tr/// works
+t/uni/tr_eucjp.t See if Unicode tr/// works
+t/uni/tr_sjis.t See if Unicode tr/// works
+t/uni/tr_utf8.t See if Unicode tr/// works
t/uni/upper.t See if Unicode casing works
t/win32/longpath.t Test if Win32::GetLongPathName() works
t/win32/system.t See if system works in Win*
--- /dev/null
+#
+# $Id$
+#
+# This script is written intentionally in EUC-JP
+# -- dankogai
+
+BEGIN {
+ if ($ENV{'PERL_CORE'}){
+ chdir 't';
+ unshift @INC, '../lib';
+ }
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bEncode\b/) {
+ print "1..0 # Skip: Encode was not built\n";
+ exit 0;
+ }
+ if (ord("A") == 193) {
+ print "1..0 # Skip: EBCDIC\n";
+ exit 0;
+ }
+ unless (PerlIO::Layer->find('perlio')){
+ print "1..0 # Skip: PerlIO required\n";
+ exit 0;
+ }
+ $| = 1;
+ print "1..0 # does not work with iso-2022-jp yet\n";
+ exit 0;
+}
+
+use strict;
+#use Test::More qw(no_plan);
+use Test::More tests => 6;
+use Encode;
+use encoding 'iso-2022-jp';
+
+my @hiragana = map {chr} ord("\e$B$!\e(B")..ord("\e$B$s\e(B");
+my @katakana = map {chr} ord("\e$B%!\e(B")..ord("\e$B%s\e(B");
+my $hiragana = join('' => @hiragana);
+my $katakana = join('' => @katakana);
+my %h2k; @h2k{@hiragana} = @katakana;
+my %k2h; @k2h{@katakana} = @hiragana;
+
+# print @hiragana, "\n";
+
+my $str;
+
+$str = $hiragana; $str =~ tr/\e$B$!\e(B-\e$B$s\e(B/\e$B%!\e(B-\e$B%s\e(B/;
+is($str, $katakana, "tr// # hiragana -> katakana");
+$str = $katakana; $str =~ tr/\e$B%!\e(B-\e$B%s\e(B/\e$B$!\e(B-\e$B$s\e(B/;
+is($str, $hiragana, "tr// # hiragana -> katakana");
+
+$str = $hiragana; eval qq(\$str =~ tr/\e$B$!\e(B-\e$B$s\e(B/\e$B%!\e(B-\e$B%s\e(B/);
+is($str, $katakana, "eval qq(tr//) # hiragana -> katakana");
+$str = $katakana; eval qq(\$str =~ tr/\e$B%!\e(B-\e$B%s\e(B/\e$B$!\e(B-\e$B$s\e(B/);
+is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana");
+
+$str = $hiragana; $str =~ s/([\e$B$!\e(B-\e$B$s\e(B])/$h2k{$1}/go;
+is($str, $katakana, "s/// # hiragana -> katakana");
+$str = $katakana; $str =~ s/([\e$B%!\e(B-\e$B%s\e(B])/$k2h{$1}/go;
+is($str, $hiragana, "s/// # hiragana -> katakana");
+__END__
--- /dev/null
+#
+# $Id$
+#
+# This script is written intentionally in EUC-JP
+# -- dankogai
+
+BEGIN {
+ if ($ENV{'PERL_CORE'}){
+ chdir 't';
+ unshift @INC, '../lib';
+ }
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bEncode\b/) {
+ print "1..0 # Skip: Encode was not built\n";
+ exit 0;
+ }
+ if (ord("A") == 193) {
+ print "1..0 # Skip: EBCDIC\n";
+ exit 0;
+ }
+ unless (PerlIO::Layer->find('perlio')){
+ print "1..0 # Skip: PerlIO required\n";
+ exit 0;
+ }
+ $| = 1;
+}
+
+use strict;
+#use Test::More qw(no_plan);
+use Test::More tests => 6;
+use Encode;
+use encoding 'euc-jp';
+
+my @hiragana = map {chr} ord("¤¡")..ord("¤ó");
+my @katakana = map {chr} ord("¥¡")..ord("¥ó");
+my $hiragana = join('' => @hiragana);
+my $katakana = join('' => @katakana);
+my %h2k; @h2k{@hiragana} = @katakana;
+my %k2h; @k2h{@katakana} = @hiragana;
+
+# print @hiragana, "\n";
+
+my $str;
+
+$str = $hiragana; $str =~ tr/¤¡-¤ó/¥¡-¥ó/;
+is($str, $katakana, "tr// # hiragana -> katakana");
+$str = $katakana; $str =~ tr/¥¡-¥ó/¤¡-¤ó/;
+is($str, $hiragana, "tr// # hiragana -> katakana");
+
+$str = $hiragana; eval qq(\$str =~ tr/¤¡-¤ó/¥¡-¥ó/);
+is($str, $katakana, "eval qq(tr//) # hiragana -> katakana");
+$str = $katakana; eval qq(\$str =~ tr/¥¡-¥ó/¤¡-¤ó/);
+is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana");
+
+$str = $hiragana; $str =~ s/([¤¡-¤ó])/$h2k{$1}/go;
+is($str, $katakana, "s/// # hiragana -> katakana");
+$str = $katakana; $str =~ s/([¥¡-¥ó])/$k2h{$1}/go;
+is($str, $hiragana, "s/// # hiragana -> katakana");
+__END__
--- /dev/null
+#
+# $Id$
+#
+# This script is written intentionally in EUC-JP
+# -- dankogai
+
+BEGIN {
+ if ($ENV{'PERL_CORE'}){
+ chdir 't';
+ unshift @INC, '../lib';
+ }
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bEncode\b/) {
+ print "1..0 # Skip: Encode was not built\n";
+ exit 0;
+ }
+ if (ord("A") == 193) {
+ print "1..0 # Skip: EBCDIC\n";
+ exit 0;
+ }
+ unless (PerlIO::Layer->find('perlio')){
+ print "1..0 # Skip: PerlIO required\n";
+ exit 0;
+ }
+ $| = 1;
+}
+
+use strict;
+#use Test::More qw(no_plan);
+use Test::More tests => 6;
+use Encode;
+use encoding 'shiftjis';
+
+my @hiragana = map {chr} ord("")..ord("ñ");
+my @katakana = map {chr} ord("@")..ord("");
+my $hiragana = join('' => @hiragana);
+my $katakana = join('' => @katakana);
+my %h2k; @h2k{@hiragana} = @katakana;
+my %k2h; @k2h{@katakana} = @hiragana;
+
+# print @hiragana, "\n";
+
+my $str;
+
+$str = $hiragana; $str =~ tr/-ñ/@-/;
+is($str, $katakana, "tr// # hiragana -> katakana");
+$str = $katakana; $str =~ tr/@-/-ñ/;
+is($str, $hiragana, "tr// # hiragana -> katakana");
+
+$str = $hiragana; eval qq(\$str =~ tr/-ñ/@-/);
+is($str, $katakana, "eval qq(tr//) # hiragana -> katakana");
+$str = $katakana; eval qq(\$str =~ tr/@-/-ñ/);
+is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana");
+
+$str = $hiragana; $str =~ s/([-ñ])/$h2k{$1}/go;
+is($str, $katakana, "s/// # hiragana -> katakana");
+$str = $katakana; $str =~ s/([@-])/$k2h{$1}/go;
+is($str, $hiragana, "s/// # hiragana -> katakana");
+__END__
--- /dev/null
+#
+# $Id$
+#
+# This script is written intentionally in EUC-JP
+# -- dankogai
+
+BEGIN {
+ if ($ENV{'PERL_CORE'}){
+ chdir 't';
+ unshift @INC, '../lib';
+ }
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bEncode\b/) {
+ print "1..0 # Skip: Encode was not built\n";
+ exit 0;
+ }
+ if (ord("A") == 193) {
+ print "1..0 # Skip: EBCDIC\n";
+ exit 0;
+ }
+ unless (PerlIO::Layer->find('perlio')){
+ print "1..0 # Skip: PerlIO required\n";
+ exit 0;
+ }
+ $| = 1;
+}
+
+use strict;
+#use Test::More qw(no_plan);
+use Test::More tests => 6;
+
+# use encoding 'utf8'; # you can't uncomment this!
+# if you uncomment above, you'll get the following (as of Encode 1.80)
+# Assertion ((dst)->sv_flags & 0xff) >= SVt_PV failed:
+# file "Encode.xs", line 255 at t/uni/tr_utf8.t line 35.
+
+my @hiragana = map {chr} ord("ぁ")..ord("ん");
+my @katakana = map {chr} ord("ァ")..ord("ン");
+my $hiragana = join('' => @hiragana);
+my $katakana = join('' => @katakana);
+my %h2k; @h2k{@hiragana} = @katakana;
+my %k2h; @k2h{@katakana} = @hiragana;
+
+# print @hiragana, "\n";
+
+my $str;
+
+$str = $hiragana; $str =~ tr/ぁ-ん/ァ-ン/;
+is($str, $katakana, "tr// # hiragana -> katakana");
+$str = $katakana; $str =~ tr/ァ-ン/ぁ-ん/;
+is($str, $hiragana, "tr// # hiragana -> katakana");
+
+$str = $hiragana; eval qq(\$str =~ tr/ぁ-ん/ァ-ン/);
+is($str, $katakana, "eval qq(tr//) # hiragana -> katakana");
+$str = $katakana; eval qq(\$str =~ tr/ァ-ン/ぁ-ん/);
+is($str, $hiragana, "eval qq(tr//) # hiragana -> katakana");
+
+$str = $hiragana; $str =~ s/([ぁ-ん])/$h2k{$1}/go;
+is($str, $katakana, "s/// # hiragana -> katakana");
+$str = $katakana; $str =~ s/([ァ-ン])/$k2h{$1}/go;
+is($str, $hiragana, "s/// # hiragana -> katakana");
+__END__