diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-23 17:07:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-23 17:07:13 +0000 |
commit | a3a22f545e149b714b6f2b17cd04a5d6e0bd5294 (patch) | |
tree | c85091fdb1158b1f0edaf40267d812197c0bc76c /tests/dialects/test_tsql.py | |
parent | Adding upstream version 6.1.1. (diff) | |
download | sqlglot-a3a22f545e149b714b6f2b17cd04a5d6e0bd5294.tar.xz sqlglot-a3a22f545e149b714b6f2b17cd04a5d6e0bd5294.zip |
Adding upstream version 6.2.0.upstream/6.2.0
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.py | 26 |
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)") |