extracttests; allow several check functions

This commit is contained in:
Daniel Marjamäki 2021-05-22 09:43:56 +02:00
parent c63aa2f2cc
commit 2cfe05b256
1 changed files with 7 additions and 5 deletions

View File

@ -127,9 +127,11 @@ class Extract:
continue continue
# check # check
res = re.match('\\s+' + check_function + '\\(' + string, line) for f in check_function:
if res is not None: res = re.match('\\s+' + f + '\\(' + string, line)
code = res.group(1) if res is not None:
code = res.group(1)
break
# code.. # code..
if code is not None: if code is not None:
@ -240,7 +242,7 @@ filename = None
htmldir = None htmldir = None
codedir = None codedir = None
onlyTP = None onlyTP = None
check_function = 'check.*' check_function = ['check[A-Za-z0-9_]*']
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
if arg == '--xml': if arg == '--xml':
xml = True xml = True
@ -253,7 +255,7 @@ for arg in sys.argv[1:]:
elif arg.endswith('.cpp'): elif arg.endswith('.cpp'):
filename = arg filename = arg
elif arg.startswith('--check-function='): elif arg.startswith('--check-function='):
check_function = arg[17:] check_function.append(arg[17:])
else: else:
print('Invalid option: ' + arg) print('Invalid option: ' + arg)
sys.exit(1) sys.exit(1)