diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-10-04 12:24:37 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-04 12:24:37 -0700 |
commit | b20c4ee1fc23699f6cbe3ce96cc8fe6eb4c52c4c (patch) | |
tree | eca209c69315093bfbc071361e1898bf6a1b109e /t | |
parent | 1ccd2973f698bfdb82dfadf6ef09ec337061a97f (diff) | |
download | perl-b20c4ee1fc23699f6cbe3ce96cc8fe6eb4c52c4c.tar.gz |
[perl #20661] Constant strings representing a number can BECOME numbers
The & | ^ operators now avoid turning on numericness of read-only
arguments.
Diffstat (limited to 't')
-rw-r--r-- | t/op/bop.t | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/t/op/bop.t b/t/op/bop.t index b7f82eefc5..fdcded1fd5 100644 --- a/t/op/bop.t +++ b/t/op/bop.t @@ -15,7 +15,7 @@ BEGIN { # If you find tests are failing, please try adding names to tests to track # down where the failure is, and supply your new names as a patch. # (Just-in-time test naming) -plan tests => 161 + (10*13*2) + 4; +plan tests => 170 + (10*13*2) + 4; # numerics ok ((0xdead & 0xbeef) == 0x9ead); @@ -63,6 +63,20 @@ is (($foo | $bar), ($Aoz x 75 . $zap)); # ^ does not truncate is (($foo ^ $bar), ($Axz x 75 . $zap)); +# string constants +sub _and($) { $_[0] & "+0" } +sub _oar($) { $_[0] | "+0" } +sub _xor($) { $_[0] ^ "+0" } +is _and "waf", '# ', 'str var & const str'; # These three +is _and 0, '0', 'num var & const str'; # are from +is _and "waf", '# ', 'str var & const str again'; # [perl #20661] +is _oar "yit", '{yt', 'str var | const str'; +is _oar 0, '0', 'num var | const str'; +is _oar "yit", '{yt', 'str var | const str again'; +is _xor "yit", 'RYt', 'str var ^ const str'; +is _xor 0, '0', 'num var ^ const str'; +is _xor "yit", 'RYt', 'str var ^ const str again'; + # is ("ok \xFF\xFF\n" & "ok 19\n", "ok 19\n"); is ("ok 20\n" | "ok \0\0\n", "ok 20\n"); |