Skip to content

Commit e80eec3

Browse files
author
thk123
committed
Add test to linter that verifies that all tests have tags
1 parent 5c03921 commit e80eec3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

scripts/cpplint.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
'runtime/string',
254254
'runtime/threadsafe_fn',
255255
'runtime/vlog',
256+
'runtime/catch_scenario',
256257
'whitespace/blank_line',
257258
'whitespace/braces',
258259
'whitespace/comma',
@@ -6149,6 +6150,25 @@ def AssembleString(clean_lines, start_lineno, start_linepos, end_lineno, end_lin
61496150
full_string += clean_lines.elided[end_lineno][:end_linepos]
61506151
return full_string
61516152

6153+
def CheckScenarioHasTags(filename, clean_lines, linenum, error):
6154+
line = clean_lines.elided[linenum]
6155+
scenario = Match(r'^SCENARIO\(', line)
6156+
if not scenario: return
6157+
6158+
closing_line, closing_linenum, closing_pos = CloseExpression(clean_lines, linenum, line.find('('))
6159+
6160+
if closing_pos == -1:
6161+
error(filename, linenum,
6162+
'runtime/catch_scenario', 4, "Can't find closing bracket for scenario")
6163+
6164+
full_string = AssembleString(
6165+
clean_lines, linenum, line.find('(') + 1, closing_linenum, closing_pos - 1)
6166+
6167+
if(full_string.find(',') == -1):
6168+
error(filename, linenum,
6169+
'runtime/catch_scenario', 4, "Can't find `,\' seperating scenario name and the tags: " + str(clean_lines.lines[linenum]))
6170+
6171+
61526172
def CheckRedundantVirtual(filename, clean_lines, linenum, error):
61536173
"""Check if line contains a redundant "virtual" function-specifier.
61546174
@@ -6342,6 +6362,7 @@ def ProcessLine(filename, file_extension, clean_lines, line,
63426362
CheckInvalidIncrement(filename, clean_lines, line, error)
63436363
CheckMakePairUsesDeduction(filename, clean_lines, line, error)
63446364
CheckRedundantVirtual(filename, clean_lines, line, error)
6365+
CheckScenarioHasTags(filename, clean_lines, line, error)
63456366
CheckNamespaceOrUsing(filename, clean_lines, line, error)
63466367
CheckForEndl(filename, clean_lines, line, error)
63476368
for check_fn in extra_check_functions:

0 commit comments

Comments
 (0)