summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_tsql.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-10-21 09:29:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-10-21 09:29:23 +0000
commitdab6ba29e8eb9a5c2890ac3be8eab6e994aeb10e (patch)
tree0d209cfc6f7b9c794c254601c29aa5d8b9414876 /tests/dialects/test_tsql.py
parentAdding upstream version 7.1.3. (diff)
downloadsqlglot-dab6ba29e8eb9a5c2890ac3be8eab6e994aeb10e.tar.xz
sqlglot-dab6ba29e8eb9a5c2890ac3be8eab6e994aeb10e.zip
Adding upstream version 9.0.1.upstream/9.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_tsql.py')
-rw-r--r--tests/dialects/test_tsql.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index b061784..9a6bc36 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -45,3 +45,29 @@ class TestTSQL(Validator):
"tsql": "CAST(x AS DATETIME2)",
},
)
+
+ def test_charindex(self):
+ self.validate_all(
+ "CHARINDEX(x, y, 9)",
+ write={
+ "spark": "LOCATE(x, y, 9)",
+ },
+ )
+ self.validate_all(
+ "CHARINDEX(x, y)",
+ write={
+ "spark": "LOCATE(x, y)",
+ },
+ )
+ self.validate_all(
+ "CHARINDEX('sub', 'testsubstring', 3)",
+ write={
+ "spark": "LOCATE('sub', 'testsubstring', 3)",
+ },
+ )
+ self.validate_all(
+ "CHARINDEX('sub', 'testsubstring')",
+ write={
+ "spark": "LOCATE('sub', 'testsubstring')",
+ },
+ )