diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-10-13 11:20:55 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-10-13 11:20:55 +0200 |
commit | c517cc62133063c088f9e68a28a065dc5e24abd1 (patch) | |
tree | 37e69aa4a951093464a9009de166598b12d3bbdf /container-search/src/test/java/com | |
parent | 9259007b603c4f5ec98597a4e1bf63e23cb660a6 (diff) |
No functional changes
Diffstat (limited to 'container-search/src/test/java/com')
-rw-r--r-- | container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java index 5beea5352aa..807681e1d7b 100644 --- a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java @@ -1002,10 +1002,21 @@ public class YqlParserTestCase { @Test void testRegexp() { - QueryTree x = parse("select * from sources * where foo matches \"a b\""); - Item root = x.getRoot(); - assertSame(RegExpItem.class, root.getClass()); - assertEquals("a b", ((RegExpItem) root).stringValue()); + { + QueryTree x = parse("select * from sources * where foo matches \"a b\""); + Item root = x.getRoot(); + assertSame(RegExpItem.class, root.getClass()); + assertEquals("a b", ((RegExpItem) root).stringValue()); + } + + { + String expression = "a\\\\.b\\\\.c"; + QueryTree query = parse("select * from sources * where foo matches \"" + expression + "\""); + var regExpItem = (RegExpItem) query.getRoot(); + assertEquals("a\\.b\\.c", regExpItem.stringValue()); + assertTrue(regExpItem.getRegexp().matcher("a.b.c").matches(), "a.b.c is matched"); + assertFalse(regExpItem.getRegexp().matcher("a,b,c").matches(), "a,b,c is matched?"); + } } @Test |