summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-12-15 17:58:30 -0700
committerKarl Williamson <khw@cpan.org>2015-12-16 12:14:46 -0700
commit87e05d1a4c512d5f08d9963b13e202483e002366 (patch)
treea8fb01774fcccf83adafb116c794c1f103341aa9 /t
parent2d212e86d115af0ec7bda9d374433535fb9b20ab (diff)
downloadperl-87e05d1a4c512d5f08d9963b13e202483e002366.tar.gz
Deprecate wide chars in logical string ops
See thread starting at http://nntp.perl.org/group/perl.perl5.porters/227698 Ricardo Signes provided the perldelta and perldiag text.
Diffstat (limited to 't')
-rw-r--r--t/lib/warnings/doop30
-rw-r--r--t/lib/warnings/pp8
-rw-r--r--t/op/substr.t1
3 files changed, 39 insertions, 0 deletions
diff --git a/t/lib/warnings/doop b/t/lib/warnings/doop
index 74c3e907fe..bcc85a365a 100644
--- a/t/lib/warnings/doop
+++ b/t/lib/warnings/doop
@@ -5,3 +5,33 @@ $_ = "\x80 \xff" ;
chop ;
EXPECT
########
+# NAME deprecation of logical bit operations with above ff code points
+$_ = "\xFF" & "\x{100}"; # Above ff second
+$_ = "\xFF" | "\x{101}";
+$_ = "\xFF" ^ "\x{102}";
+$_ = "\x{100}" & "\x{FF}"; # Above ff first
+$_ = "\x{101}" | "\x{FF}";
+$_ = "\x{102}" ^ "\x{FF}";
+$_ = "\x{100}" & "\x{103}"; # both above ff has just one message raised
+$_ = "\x{101}" | "\x{104}";
+$_ = "\x{102}" ^ "\x{105}";
+no warnings 'deprecated';
+$_ = "\xFF" & "\x{100}";
+$_ = "\xFF" | "\x{101}";
+$_ = "\xFF" ^ "\x{101}";
+$_ = "\x{100}" & "\x{FF}";
+$_ = "\x{101}" | "\x{FF}";
+$_ = "\x{102}" ^ "\x{FF}";
+$_ = "\x{100}" & "\x{103}";
+$_ = "\x{101}" | "\x{104}";
+$_ = "\x{102}" ^ "\x{105}";
+EXPECT
+Use of strings with code points over 0xFF as arguments to bitwise and (&) operator is deprecated at - line 1.
+Use of strings with code points over 0xFF as arguments to bitwise or (|) operator is deprecated at - line 2.
+Use of strings with code points over 0xFF as arguments to bitwise xor (^) operator is deprecated at - line 3.
+Use of strings with code points over 0xFF as arguments to bitwise and (&) operator is deprecated at - line 4.
+Use of strings with code points over 0xFF as arguments to bitwise or (|) operator is deprecated at - line 5.
+Use of strings with code points over 0xFF as arguments to bitwise xor (^) operator is deprecated at - line 6.
+Use of strings with code points over 0xFF as arguments to bitwise and (&) operator is deprecated at - line 7.
+Use of strings with code points over 0xFF as arguments to bitwise or (|) operator is deprecated at - line 8.
+Use of strings with code points over 0xFF as arguments to bitwise xor (^) operator is deprecated at - line 9.
diff --git a/t/lib/warnings/pp b/t/lib/warnings/pp
index ab8f951651..3324ccc563 100644
--- a/t/lib/warnings/pp
+++ b/t/lib/warnings/pp
@@ -128,3 +128,11 @@ use utf8 ;
$_ = "\x80 \xff" ;
reverse ;
EXPECT
+########
+# NAME deprecation of complement with above ff code points
+$_ = ~ "\xff";
+$_ = ~ "\x{100}";
+EXPECT
+OPTION regex
+Use of strings with code points over 0xFF as arguments to 1's complement \(~\) operator is deprecated at - line \d+.
+Use of code point 0xFF+EFF is deprecated; the permissible max is 0x7F+ at - line \d+.
diff --git a/t/op/substr.t b/t/op/substr.t
index 71e9e8942a..eae24030ff 100644
--- a/t/op/substr.t
+++ b/t/op/substr.t
@@ -714,6 +714,7 @@ is($x, "\x{100}\x{200}\xFFb");
# [perl #23765]
{
my $a = pack("C", 0xbf);
+ no warnings 'deprecated';
substr($a, -1) &= chr(0xfeff);
is($a, "\xbf");
}