julianhyde commented on code in PR #3565:
URL: https://github.com/apache/calcite/pull/3565#discussion_r1434504495
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -8878,51 +8878,106 @@ private void testCurrentDateFunc(Pair<String,
Hook.Closeable> pair) {
}
@Test void testStartsWithFunction() {
- final SqlOperatorFixture f = fixture().withLibrary(SqlLibrary.BIG_QUERY);
- f.setFor(SqlLibraryOperators.STARTS_WITH);
- f.checkBoolean("starts_with('12345', '123')", true);
- f.checkBoolean("starts_with('12345', '1243')", false);
- f.checkBoolean("starts_with(x'11', x'11')", true);
- f.checkBoolean("starts_with(x'112211', x'33')", false);
- f.checkFails("^starts_with('aabbcc', x'aa')^",
- "Cannot apply 'STARTS_WITH' to arguments of type "
- + "'STARTS_WITH\\(<CHAR\\(6\\)>, <BINARY\\(1\\)>\\)'\\. Supported "
- + "form\\(s\\): 'STARTS_WITH\\(<STRING>, <STRING>\\)'",
- false);
- f.checkNull("starts_with(null, null)");
- f.checkNull("starts_with('12345', null)");
- f.checkNull("starts_with(null, '123')");
- f.checkBoolean("starts_with('', '123')", false);
- f.checkBoolean("starts_with('', '')", true);
- f.checkNull("starts_with(x'aa', null)");
- f.checkNull("starts_with(null, x'aa')");
- f.checkBoolean("starts_with(x'1234', x'')", true);
- f.checkBoolean("starts_with(x'', x'123456')", false);
- f.checkBoolean("starts_with(x'', x'')", true);
+ final SqlOperatorFixture f0 = fixture();
Review Comment:
I wish there was a way to create tests for functions that are aliases (e.g.
starts_with and startswith, length and char_length) that did not use
copy-paste. Any ideas?
--
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]