Refactor the code
apjanke opened this issue · 2 comments
apjanke commented
The test
function's code has some issues:
- The main function is several hundred lines long.
- Logic for parsing tests, running tests, and tracking results is interleaved across the whole function.
- All variables are prefixed with "__", hurting readability.
- It uses local functions, which can't be called directly, so they're hard to test.
- Results tracking is handled by seven or eight separate local variables.
- It uses
eval
logic with generated temporary function strings, which is a little hard to follow.
Same goes for runtests
, to a lesser extent.
Refactor the code to address this.
TODO
- Factor out test-running implementation to objects
- Test results summary in
runtests2
-
Giveruntests2
log file handling (for the lower-leveltest
output) - More sophisticated input parsing for runtests2, for multiple targets, logging options, etc.
- Have
__run_test_suite__
use runtest2's summary output