diff options
Diffstat (limited to 'tests/micropython/const_error.py')
-rw-r--r-- | tests/micropython/const_error.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/micropython/const_error.py b/tests/micropython/const_error.py index fa7deaaf3..b46efcae2 100644 --- a/tests/micropython/const_error.py +++ b/tests/micropython/const_error.py @@ -1,6 +1,13 @@ -# make sure syntax error works corrects for bad const definition +# make sure syntax error works correctly for bad const definition -try: - exec("a = const(x)") -except SyntaxError: - print("SyntaxError") +def test_syntax(code): + try: + exec(code) + except SyntaxError: + print("SyntaxError") + +# argument not a constant +test_syntax("a = const(x)") + +# redefined constant +test_syntax("A = const(1); A = const(2)") |