diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-11-02 20:19:25 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-11-02 21:32:34 -0700 |
commit | bb16bae836f8e26795fbfac1361bf85da0d6a912 (patch) | |
tree | b71601a317ae4fc0b2f334d106d4d7815a86e708 /t/op/tr.t | |
parent | 4eedab498fc909c786cceea9a6f3a70fa4433f9b (diff) | |
download | perl-bb16bae836f8e26795fbfac1361bf85da0d6a912.tar.gz |
y///r
Diffstat (limited to 't/op/tr.t')
-rw-r--r-- | t/op/tr.t | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 119; +plan tests => 128; my $Is_EBCDIC = (ord('i') == 0x89 & ord('J') == 0xd1); @@ -44,6 +44,27 @@ is($_, "aBCDEFGHIJKLMNOPQRSTUVWXYz", 'partial uc'); (my $g = 1.5) =~ tr/1/3/; is($x + $y + $f + $g, 71, 'tr cancels IOK and NOK'); +# /r +$_ = 'adam'; +is y/dam/ve/rd, 'eve', '/r'; +is $_, 'adam', '/r leaves param alone'; +$g = 'ruby'; +is $g =~ y/bury/repl/r, 'perl', '/r with explicit param'; +is $g, 'ruby', '/r leaves explicit param alone'; +is "aaa" =~ y\a\b\r, 'bbb', '/r with constant param'; +ok !eval '$_ !~ y///r', "!~ y///r is forbidden"; +like $@, qr\^Using !~ with tr///r doesn't make sense\, + "!~ y///r error message"; +{ + my $w; + my $wc; + local $SIG{__WARN__} = sub { $w = shift; ++$wc }; + local $^W = 1; + eval 'y///r; 1'; + like $w, qr '^Useless use of non-destructive transliteration \(tr///r\)', + '/r warns in void context'; + is $wc, 1, '/r warns just once'; +} # perlbug [ID 20000511.005] $_ = 'fred'; |