Fix some bugs in test_testsuite.py
Support index terms, prevent _ as prefix and fix some parser bugs