From 214179b430ebc1101e28b19248b6166f5e511e6b Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 25 Mar 2015 23:10:09 +0000 Subject: tests: Add tests for SyntaxError, TypeError, and other missing things. This is intended to improve coverage of the test suite. --- tests/micropython/const_error.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'tests/micropython/const_error.py') 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)") -- cgit v1.2.3