diff options
author | Damien George <damien.p.george@gmail.com> | 2015-03-25 23:10:09 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-03-25 23:10:09 +0000 |
commit | 214179b430ebc1101e28b19248b6166f5e511e6b (patch) | |
tree | 74f8dc7b2e9dbfd902514b82a698e9ddaa8bb4bc /tests/micropython/const_error.py | |
parent | 44f65c0e2f5ce27ce90bbec218ecb39cba9d75a2 (diff) |
tests: Add tests for SyntaxError, TypeError, and other missing things.
This is intended to improve coverage of the test suite.
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)") |