summaryrefslogtreecommitdiff
path: root/t/re
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-05-03 11:44:28 -0600
committerJesse Vincent <jesse@bestpractical.com>2011-05-03 17:14:06 -0400
commit827f5bb80b513fa181ae206648e6d58d9d82eb29 (patch)
treeaf4604d629d45908c5522e6bd0ba93dde7734a1c /t/re
parent36bb2ab64fa2ef022d7870082c0dcc6db902c86e (diff)
downloadperl-827f5bb80b513fa181ae206648e6d58d9d82eb29.tar.gz
PATCH: [perl #89750]: Unicode regex negated case-insensitivity
This patch causes inverted [bracketed] character classes to not handle multi-character folds. The reason is that these can lead to very counter-intuitive results (see bug discussion). In an inverted character class, only single-char folds are now generated. However the fold for \xDF=>ss is hard-coded in, and it was too much trouble sending flags to the sub-sub routine that does this, so another check is done at the point of storing the list of multi-char folds. Since \xDF doesn't have a single char fold, this works.
Diffstat (limited to 't/re')
-rw-r--r--t/re/fold_grind.t2
-rw-r--r--t/re/re_tests5
2 files changed, 7 insertions, 0 deletions
diff --git a/t/re/fold_grind.t b/t/re/fold_grind.t
index 82ca6ad249..460d296644 100644
--- a/t/re/fold_grind.t
+++ b/t/re/fold_grind.t
@@ -452,6 +452,8 @@ foreach my $test (sort { numerically } keys %tests) {
foreach my $bracketed (0, 1) { # Put rhs in [...], or not
foreach my $inverted (0,1) {
next if $inverted && ! $bracketed; # inversion only valid in [^...]
+ next if $inverted && @target != 1; # [perl #89750] multi-char
+ # not valid in [^...]
# In some cases, add an extra character that doesn't fold, and
# looks ok in the output.
diff --git a/t/re/re_tests b/t/re/re_tests
index 9d5341b4c8..35a72203cd 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1517,4 +1517,9 @@ abc\N{def - c - \\N{NAME} must be resolved by the lexer
/s/aia S y $& S
/(?aia:s)/ \x{17F} n - -
/(?aia:s)/ S y $& S
+
+# Normally 1E9E generates a multi-char fold, but not in inverted class;
+# See [perl #89750]. This makes sure that the simple fold gets generated
+# in that case, to DF.
+/[^\x{1E9E}]/i \x{DF} n - -
# vim: softtabstop=0 noexpandtab