From 31ae3604e91b534f99f9dd92647e555601952cf2 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 26 Jun 2012 18:14:23 -0600 Subject: [PATCH] reg_fold.t: Make test cases non-optimizable away This commit changes the bracketed character classes to include a non-related character. This is in preparation for a future commit which would cause the current character classes to be optimized into EXACTish nodes which would start passing TODO tests, but don't fix the underlying problem with character classes. That bug is that you can't split a multi-char fold across nodes. It probably is not fixable in Perl without a total restructuring of the regular expression mechanism. For example, "\N{LATIN SMALL LIGATURE FFI}" doesn't match /[f][f][i]/i. But it would if those got optimized into a single EXACTF node. (The problem is not limited to character classes, /(f)(f)(i)/i also doesn't match, and can't, as $1, $2, and $3 are not well-defined.) --- t/re/reg_fold.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/re/reg_fold.t b/t/re/reg_fold.t index 9b5ef11..9e97ddd 100644 --- a/t/re/reg_fold.t +++ b/t/re/reg_fold.t @@ -76,7 +76,11 @@ for (@folds) { $lhs = $chr; $rhs = ""; foreach my $rhs_char (@folded) { - $rhs .= '[' if $charclass; + + # The colon is an unrelated character to the rest of the + # class, and makes sure no optimization into an EXACTish + # node occurs. + $rhs .= '[:' if $charclass; $rhs .= $rhs_char; $rhs .= ']' if $charclass; } -- 2.7.4