tests(parser): add syntax error test

This commit is contained in:
2026-05-18 13:43:12 +02:00
parent 6f0c0ce326
commit 7581a35be4

View File

@@ -103,3 +103,27 @@ def test_literals(src: str, expected_type: TokenType, expected_value: Any):
assert_n_tokens(tokens, 1)
assert tokens[0].type == expected_type
assert tokens[0].value == expected_value
def test_single_bang_error():
with pytest.raises(SyntaxError):
scan("!")
@pytest.mark.parametrize(
"src",
[
"-",
"*",
"/",
"{",
"}",
"@",
'"',
"'",
".",
],
)
def test_unexpected_character(src: str):
with pytest.raises(SyntaxError):
scan(src)