This is an automated email from the ASF dual-hosted git repository.
mbudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new 7efef39007 [CALCITE-6490] Missing tests for SqlFunctions#overlay
7efef39007 is described below
commit 7efef39007389276c8aa955fdabeded325c42643
Author: Tim Grein <[email protected]>
AuthorDate: Sun Jul 21 22:35:34 2024 +0200
[CALCITE-6490] Missing tests for SqlFunctions#overlay
---
.../test/java/org/apache/calcite/test/SqlFunctionsTest.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java
b/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java
index 0f9f9049ed..c96fe61ad9 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlFunctionsTest.java
@@ -59,6 +59,7 @@ import static org.apache.calcite.runtime.SqlFunctions.lesser;
import static org.apache.calcite.runtime.SqlFunctions.lower;
import static org.apache.calcite.runtime.SqlFunctions.ltrim;
import static org.apache.calcite.runtime.SqlFunctions.md5;
+import static org.apache.calcite.runtime.SqlFunctions.overlay;
import static org.apache.calcite.runtime.SqlFunctions.position;
import static org.apache.calcite.runtime.SqlFunctions.rtrim;
import static org.apache.calcite.runtime.SqlFunctions.sha1;
@@ -716,6 +717,15 @@ class SqlFunctionsTest {
assertThat(trimSpacesBoth("x"), is("x"));
}
+ /** Test for {@link SqlFunctions#overlay}. */
+ @Test void testOverlay() {
+ assertThat(overlay("HelloWorld", "Java", 6), is("HelloJavad"));
+ assertThat(overlay("Hello World", "World", 1), is("World World"));
+ assertThat(overlay("HelloWorld", "Java", 6, 5), is("HelloJava"));
+ assertThat(overlay("HelloWorld", "Java", 6, 0), is("HelloJavaWorld"));
+ }
+
+
static String trimSpacesBoth(String s) {
return trim(true, true, " ", s);
}