tests: Split out test for optimisation level and line-no printing.

pull/5041/head
Damien George 2019-08-23 11:25:46 +10:00
rodzic af20c2ead3
commit b3152b2de7
5 zmienionych plików z 10 dodań i 8 usunięć

Wyświetl plik

@ -12,8 +12,3 @@ exec('print(__debug__)')
micropython.opt_level(1)
exec('print(__debug__)')
exec('assert 0')
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec('try:\n xyz\nexcept NameError as er:\n import sys\n sys.print_exception(er)')

Wyświetl plik

@ -2,6 +2,3 @@
1
True
False
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'xyz' isn't defined

Wyświetl plik

@ -0,0 +1,6 @@
import micropython as micropython
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec('try:\n xyz\nexcept NameError as er:\n import sys\n sys.print_exception(er)')

Wyświetl plik

@ -0,0 +1,3 @@
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'xyz' isn't defined

Wyświetl plik

@ -377,6 +377,7 @@ def run_tests(pyb, tests, args, base_path="."):
skip_tests.add('misc/sys_exc_info.py') # sys.exc_info() is not supported for native
skip_tests.add('micropython/emg_exc.py') # because native doesn't have proper traceback info
skip_tests.add('micropython/heapalloc_traceback.py') # because native doesn't have proper traceback info
skip_tests.add('micropython/opt_level_lineno.py') # native doesn't have proper traceback info
skip_tests.add('micropython/schedule.py') # native code doesn't check pending events
for test_file in tests: