X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Ftr.t;h=6390f6a9e5950c22078c88acfadb400e8be20a6b;hb=a4c04bdcc508b6a45f83e703d0f82401445aa55b;hp=e815cf2563a7a96b5113d196ee9ada37f40c79dd;hpb=1ed601ecfa74af5f3658ce7ccdb6a4fecf7ee591;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/tr.t b/t/op/tr.t index e815cf2..6390f6a 100755 --- a/t/op/tr.t +++ b/t/op/tr.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..65\n"; +print "1..70\n"; $_ = "abcdefghijklmnopqrstuvwxyz"; @@ -80,9 +80,6 @@ else { print "ok 10\n"; { -if (ord("\t") == 9) { # ASCII - use utf8; -} # 11 - changing UTF8 characters in a UTF8 string, same length. my $l = chr(300); my $r = chr(400); $x = 200.300.400; @@ -367,3 +364,27 @@ print "ok 64\n"; print "not " unless $a eq "\x{100}"; print "ok 65\n"; +$a = "\xfe\xff"; $a =~ tr/\xfe\xff/\x{1ff}\x{1fe}/; +print "not " unless $a eq "\x{1ff}\x{1fe}"; +print "ok 66\n"; + +# From David Dyck +($a = "R0_001") =~ tr/R_//d; +print "not " if hex($a) != 1; +print "ok 67\n"; + +# From Inaba Hiroto +@a = (1,2); map { y/1/./ for $_ } @a; +print "not " if "@a" ne ". 2"; +print "ok 68\n"; + +@a = (1,2); map { y/1/./ for $_.'' } @a; +print "not " if "@a" ne "1 2"; +print "ok 69\n"; + +# Additional test for Inaba Hiroto patch (robin@kitsite.com) +($a = "\x{100}\x{102}\x{101}") =~ tr/\x00-\377/XYZ/c; +print "not " unless $a eq "XZY"; +print "ok 70\n"; + +