Anthrino commented on code in PR #3338:
URL: https://github.com/apache/calcite/pull/3338#discussion_r1291725341
##########
core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java:
##########
@@ -234,6 +235,34 @@ static <E> List<E> list() {
assertThat(posixRegex("abcq", "[[:xdigit:]]", false), is(true));
}
+ @Test void testRegexpContains() {
+ try {
+ regexpContains("abc def ghi", "(abc");
+ fail("'regexp_contains' on an invalid regex input '(abc' is not
possible");
+ } catch (CalciteException e) {
+ assertThat(e.getMessage(),
+ is("Invalid regex input for REGEXP_CONTAINS: 'Unclosed group near
index 4\n(abc'"));
Review Comment:
> Break strings after each `\n`. It makes them easier to read.
Thanks for the pointer @julianhyde, the \n is included only as it is part of
the exception message returned, I can break the string for legibility but this
was easier to match with the returned string.
> I'm surprised that this test works. Does `regexpContains` throw a
`CalciteException`? Looks like it throws a `RuntimeException`.
Yes we were returning a `CalciteException` previously, saw your comment on
the other file will modify it to a `RuntimeException`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]