Skip to content

Commit 8ce5d29

Browse files
committed
Fix case-insensitive test generation with Unicodes
This excludes from testing the strings containing Unicode chars that change length when changing case.
1 parent d597e50 commit 8ce5d29

File tree

2 files changed

+9
-32
lines changed

2 files changed

+9
-32
lines changed

muted-tests.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -498,36 +498,6 @@ tests:
498498
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
499499
method: testEvaluateInManyThreads {TestCase=100 random code points matches self case insensitive with text}
500500
issue: https://github.com/elastic/elasticsearch/issues/128677
501-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
502-
method: testEvaluateInManyThreads {TestCase=100 random code points matches self case insensitive with text}
503-
issue: https://github.com/elastic/elasticsearch/issues/128705
504-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
505-
method: testEvaluateInManyThreads {TestCase=100 random code points matches self case insensitive with keyword}
506-
issue: https://github.com/elastic/elasticsearch/issues/128706
507-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
508-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
509-
issue: https://github.com/elastic/elasticsearch/issues/128710
510-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
511-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
512-
issue: https://github.com/elastic/elasticsearch/issues/128711
513-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
514-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
515-
issue: https://github.com/elastic/elasticsearch/issues/128712
516-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
517-
method: testCrankyEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
518-
issue: https://github.com/elastic/elasticsearch/issues/128713
519-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
520-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
521-
issue: https://github.com/elastic/elasticsearch/issues/128714
522-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLikeTests
523-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
524-
issue: https://github.com/elastic/elasticsearch/issues/128715
525-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
526-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with keyword}
527-
issue: https://github.com/elastic/elasticsearch/issues/128716
528-
- class: org.elasticsearch.xpack.esql.expression.function.scalar.string.RLikeTests
529-
method: testEvaluateBlockWithNulls {TestCase=100 random code points matches self case insensitive with text}
530-
issue: https://github.com/elastic/elasticsearch/issues/128717
531501
- class: org.elasticsearch.compute.operator.LimitOperatorTests
532502
method: testEarlyTermination
533503
issue: https://github.com/elastic/elasticsearch/issues/128721

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/RLikeTests.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,15 @@ private static void casesForString(
9494
return new TextAndPattern(text, escapeString.apply(text));
9595
}, true);
9696
cases(cases, title + " matches self case insensitive", () -> {
97-
String text = textSupplier.get();
98-
return new TextAndPattern(randomCasing(text), escapeString.apply(text));
97+
// RegExp doesn't support case-insensitive matching for Unicodes whose length changes when the case changes.
98+
// Example: a case-insensitive ES regexp query for the pattern `weiß` won't match the value `WEISS` (but will match `WEIß`).
99+
// Or `ʼn` (U+0149) vs. `ʼN` (U+02BC U+004E).
100+
String text, caseChanged;
101+
for (text = textSupplier.get(), caseChanged = randomCasing(text); text.length() != caseChanged.length(); ) {
102+
text = textSupplier.get();
103+
caseChanged = randomCasing(text);
104+
}
105+
return new TextAndPattern(caseChanged, escapeString.apply(text));
99106
}, true, true);
100107
cases(cases, title + " doesn't match self with trailing", () -> {
101108
String text = textSupplier.get();

0 commit comments

Comments
 (0)