summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/parser.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-07-24 15:05:56 +0000
committerDamien George <damien.p.george@gmail.com>2015-07-24 15:05:56 +0000
commit96f0dd3cbc404b7f96bd7a35247faea8da266638 (patch)
tree40a8158c2ac570d5a895a680063742a41bd7d1cd /tests/basics/parser.py
parentfa7c61dfab0822619451673d726a5b444d3a9d28 (diff)
downloadmicropython-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.py24
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")