summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_tsql.py
diff options
context:
space:
mode:
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
new file mode 100644
index 0000000..0619eaa
--- /dev/null
+++ b/tests/dialects/test_tsql.py
@@ -0,0 +1,26 @@
+from tests.dialects.test_dialect import Validator
+
+
+class TestTSQL(Validator):
+ dialect = "tsql"
+
+ def test_tsql(self):
+ self.validate_identity('SELECT "x"."y" FROM foo')
+
+ self.validate_all(
+ "SELECT CAST([a].[b] AS SMALLINT) FROM foo",
+ write={
+ "tsql": 'SELECT CAST("a"."b" AS SMALLINT) FROM foo',
+ "spark": "SELECT CAST(`a`.`b` AS SHORT) FROM foo",
+ },
+ )
+
+ def test_types(self):
+ self.validate_identity("CAST(x AS XML)")
+ self.validate_identity("CAST(x AS UNIQUEIDENTIFIER)")
+ self.validate_identity("CAST(x AS MONEY)")
+ self.validate_identity("CAST(x AS SMALLMONEY)")
+ self.validate_identity("CAST(x AS ROWVERSION)")
+ self.validate_identity("CAST(x AS IMAGE)")
+ self.validate_identity("CAST(x AS SQL_VARIANT)")
+ self.validate_identity("CAST(x AS BIT)")