Skip to content

Commit 52b7b7a

Browse files
authored
[Tests] Handle escape char correctly in wildcard patterns (#69850)
Escape char is handled specially while building automaton. It should also be handled when buidling the target text for matching.
1 parent 2561b94 commit 52b7b7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/support/StringMatcherTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void testSingleQuestionMark() throws Exception {
4545

4646
public void testUnicodeWildcard() throws Exception {
4747
// Lucene automatons don't work correctly on strings with high surrogates
48-
final String prefix = randomValueOtherThanMany(StringMatcherTests::hasHighSurrogate,
48+
final String prefix = randomValueOtherThanMany(s -> StringMatcherTests.hasHighSurrogate(s) || s.contains("\\"),
4949
() -> randomRealisticUnicodeOfLengthBetween(3, 5));
5050
final StringMatcher matcher = StringMatcher.of(prefix + "*");
5151
for (int i = 0; i < 10; i++) {

0 commit comments

Comments
 (0)