From 92dd905c165ef5968082d30c40de90184e2bf0ac Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 19 Aug 2013 22:38:43 -0600 Subject: [PATCH] fold_grind.t: Modify trie test The trie tests just add an alternation of a fixed string. This commit makes that string the same number of bytes as the first alternative, in an effort to not bias the test. Otherwise, something that might otherwise appear to be too short might be long enough to match the fixed string, defeating properly testing the length. --- t/re/fold_grind.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/t/re/fold_grind.t b/t/re/fold_grind.t index 9d9f426..5782dfc 100644 --- a/t/re/fold_grind.t +++ b/t/re/fold_grind.t @@ -697,7 +697,16 @@ foreach my $test (sort { numerically } keys %tests) { } # See if works on what could be a simple trie. - $eval = "my \$c = \"$lhs\"; my \$p = qr/$rhs|xyz/i$charset;$upgrade_target$upgrade_pattern \$c $op \$p"; + my $alternate; + { + # Keep the alternate | branch the same length as the tested one so + # that it's length doesn't influence things + my $evaled = eval "\"$rhs\""; # Convert e.g. \x{foo} into its + # chr equivalent + use bytes; + $alternate = 'q' x length $evaled; + } + $eval = "my \$c = \"$lhs\"; my \$p = qr/$rhs|$alternate/i$charset;$upgrade_target$upgrade_pattern \$c $op \$p"; run_test($eval, "", ""); # Check that works when the folded character follows something that -- 2.7.4