summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_error.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython/viper_error.py')
-rw-r--r--tests/micropython/viper_error.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/micropython/viper_error.py b/tests/micropython/viper_error.py
new file mode 100644
index 000000000..514acebd7
--- /dev/null
+++ b/tests/micropython/viper_error.py
@@ -0,0 +1,11 @@
+# test syntax errors specific to viper code generation
+
+def test_syntax(code):
+ try:
+ exec(code)
+ except SyntaxError:
+ print("SyntaxError")
+
+# viper: annotations must be identifiers
+test_syntax("@micropython.viper\ndef f(a:1): pass")
+test_syntax("@micropython.viper\ndef f() -> 1: pass")