diff options
author | Damien George <damien.p.george@gmail.com> | 2015-04-04 23:16:22 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-04-04 23:16:22 +0100 |
commit | 97abe22963af5b62656cef5a46c195215f75f7d2 (patch) | |
tree | 40929dd2cac2ee1e03af4edd5d3fb870f9ac989f /tests/basics/syntaxerror.py | |
parent | 9dd36404646f857c4f250537bac0d9a8ad041d25 (diff) |
tests: Add tests to exercise lexer; and some more complex number tests.
Diffstat (limited to 'tests/basics/syntaxerror.py')
-rw-r--r-- | tests/basics/syntaxerror.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/basics/syntaxerror.py b/tests/basics/syntaxerror.py index f53b2c41d..fc8b92d39 100644 --- a/tests/basics/syntaxerror.py +++ b/tests/basics/syntaxerror.py @@ -4,9 +4,28 @@ def test_syntax(code): try: exec(code) print("no SyntaxError") + except IndentationError: + print("IndentationError") except SyntaxError: print("SyntaxError") +# non-newline after line-continuation character (lexer error) +test_syntax("a \\a\n") + +# dedent mismatch (lexer error) +test_syntax("def f():\n a\n a\n") + +# unclosed string (lexer error) +test_syntax("'abc") + +# invalid (lexer error) +test_syntax("!") +test_syntax("$") +test_syntax("`") + +# bad indentation (lexer error) +test_syntax(" a\n") + # can't assign to literals test_syntax("1 = 2") test_syntax("'' = 1") |