diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-03 09:12:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-03 09:12:28 +0000 |
commit | 67c28dbe67209effad83d93b850caba5ee1e20e3 (patch) | |
tree | dffdfbfb4f0899c92a4c978e6eac55af2ff76367 /tests/test_tokens.py | |
parent | Releasing debian version 11.5.2-1. (diff) | |
download | sqlglot-67c28dbe67209effad83d93b850caba5ee1e20e3.tar.xz sqlglot-67c28dbe67209effad83d93b850caba5ee1e20e3.zip |
Merging upstream version 11.7.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_tokens.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/test_tokens.py b/tests/test_tokens.py index 8481f4d..987c60b 100644 --- a/tests/test_tokens.py +++ b/tests/test_tokens.py @@ -14,6 +14,7 @@ class TestTokens(unittest.TestCase): ("foo", []), ("foo /*comment 1*/ /*comment 2*/", ["comment 1", "comment 2"]), ("foo\n-- comment", [" comment"]), + ("1 /*/2 */", ["/2 "]), ] for sql, comment in sql_comment: @@ -22,14 +23,17 @@ class TestTokens(unittest.TestCase): def test_token_line(self): tokens = Tokenizer().tokenize( """SELECT /* - line break - */ - 'x - y', - x""" +line break +*/ +'x + y', +x""" ) + self.assertEqual(tokens[1].line, 5) + self.assertEqual(tokens[1].col, 3) self.assertEqual(tokens[-1].line, 6) + self.assertEqual(tokens[-1].col, 1) def test_command(self): tokens = Tokenizer().tokenize("SHOW;") @@ -46,6 +50,10 @@ class TestTokens(unittest.TestCase): self.assertEqual(tokens[2].token_type, TokenType.SHOW) self.assertEqual(tokens[3].token_type, TokenType.SEMICOLON) + def test_error_msg(self): + with self.assertRaisesRegex(ValueError, "Error tokenizing 'select.*"): + Tokenizer().tokenize("select /*") + def test_jinja(self): tokenizer = Tokenizer() |