diff options
author | Damien George <damien.p.george@gmail.com> | 2015-07-24 15:05:56 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-07-24 15:05:56 +0000 |
commit | 96f0dd3cbc404b7f96bd7a35247faea8da266638 (patch) | |
tree | 40a8158c2ac570d5a895a680063742a41bd7d1cd /tests/basics/parser.py | |
parent | fa7c61dfab0822619451673d726a5b444d3a9d28 (diff) | |
download | micropython-96f0dd3cbc404b7f96bd7a35247faea8da266638.tar.gz micropython-96f0dd3cbc404b7f96bd7a35247faea8da266638.zip |
py/parse: Fix handling of empty input so it raises an exception.
Diffstat (limited to 'tests/basics/parser.py')
-rw-r--r-- | tests/basics/parser.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/basics/parser.py b/tests/basics/parser.py new file mode 100644 index 0000000000..e12f02599e --- /dev/null +++ b/tests/basics/parser.py @@ -0,0 +1,24 @@ +# parser tests + +# completely empty string +# uPy and CPy differ for this case +#try: +# compile("", "stdin", "single") +#except SyntaxError: +# print("SyntaxError") +try: + compile("", "stdin", "eval") +except SyntaxError: + print("SyntaxError") +compile("", "stdin", "exec") + +# empty continued line +try: + compile("\\\n", "stdin", "single") +except SyntaxError: + print("SyntaxError") +try: + compile("\\\n", "stdin", "eval") +except SyntaxError: + print("SyntaxError") +compile("\\\n", "stdin", "exec") |