diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-06-01 09:05:34 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-06-01 09:05:34 +0000 |
commit | 2de7b02f486a4ffa238ed2bfc9a7e642ed40e737 (patch) | |
tree | cb7caf3f301f2f0ae910faf71928c46206332e6b /t/op/tr.t | |
parent | be573f631d93a503246e9a83f3e8e876f6c5fcfb (diff) | |
download | perl-2de7b02f486a4ffa238ed2bfc9a7e642ed40e737.tar.gz |
counting tr/// corrupts later operation (from M.J.T Guy)
p4raw-id: //depot/perl@6189
Diffstat (limited to 't/op/tr.t')
-rwxr-xr-x | t/op/tr.t | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -5,7 +5,7 @@ BEGIN { unshift @INC, "../lib"; } -print "1..4\n"; +print "1..8\n"; $_ = "abcdefghijklmnopqrstuvwxyz"; @@ -37,3 +37,27 @@ print "ok 3\n"; print "ok 4\n"; } # + +# make sure that tr cancels IOK and NOK +($x = 12) =~ tr/1/3/; +(my $y = 12) =~ tr/1/3/; +($f = 1.5) =~ tr/1/3/; +(my $g = 1.5) =~ tr/1/3/; +print "not " unless $x + $y + $f + $g == 71; +print "ok 5\n"; + +# make sure tr is harmless if not updating - see [ID 20000511.005] +$_ = 'fred'; +/([a-z]{2})/; +$1 =~ tr/A-Z//; +s/^(\s*)f/$1F/; +print "not " if $_ ne 'Fred'; +print "ok 6\n"; + +# check tr handles UTF8 correctly +($x = 256.65.258) =~ tr/a/b/; +print "not " if $x ne 256.65.258 or length $x != 3; +print "ok 7\n"; +$x =~ tr/A/B/; +print "not " if $x ne 256.66.258 or length $x != 3; +print "ok 8\n"; |