Skip to content

Commit 5a16865

Browse files
author
thk123
committed
Check test cases as well as scenarios
1 parent aac3efc commit 5a16865

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

scripts/cpplint.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
'runtime/string',
254254
'runtime/threadsafe_fn',
255255
'runtime/vlog',
256-
'runtime/catch_scenario',
256+
'runtime/catch_test_tags',
257257
'whitespace/blank_line',
258258
'whitespace/braces',
259259
'whitespace/comma',
@@ -6150,24 +6150,23 @@ def AssembleString(clean_lines, start_lineno, start_linepos, end_lineno, end_lin
61506150
full_string += clean_lines.elided[end_lineno][:end_linepos]
61516151
return full_string
61526152

6153-
def CheckScenarioHasTags(filename, clean_lines, linenum, error):
6153+
def CheckCatchTestHasTags(filename, clean_lines, linenum, error):
61546154
line = clean_lines.elided[linenum]
6155-
scenario = Match(r'^SCENARIO\(', line)
6156-
if not scenario: return
6155+
test = Match(r'^(SCENARIO|TEST_CASE)\(', line)
6156+
if not test: return
61576157

61586158
closing_line, closing_linenum, closing_pos = CloseExpression(clean_lines, linenum, line.find('('))
61596159

61606160
if closing_pos == -1:
61616161
error(filename, linenum,
6162-
'runtime/catch_scenario', 4, "Can't find closing bracket for scenario")
6162+
'runtime/catch_test_tags', 4, "Can't find closing bracket for catch test")
61636163

61646164
full_string = AssembleString(
61656165
clean_lines, linenum, line.find('(') + 1, closing_linenum, closing_pos - 1)
61666166

61676167
if(full_string.find(',') == -1):
61686168
error(filename, linenum,
6169-
'runtime/catch_scenario', 4, "Can't find `,\' seperating scenario name and the tags: " + str(clean_lines.lines[linenum]))
6170-
6169+
'runtime/catch_test_tags', 4, "Can't find `,\' seperating test name and the tags: " + str(clean_lines.lines[linenum]))
61716170

61726171
def CheckRedundantVirtual(filename, clean_lines, linenum, error):
61736172
"""Check if line contains a redundant "virtual" function-specifier.
@@ -6362,7 +6361,7 @@ def ProcessLine(filename, file_extension, clean_lines, line,
63626361
CheckInvalidIncrement(filename, clean_lines, line, error)
63636362
CheckMakePairUsesDeduction(filename, clean_lines, line, error)
63646363
CheckRedundantVirtual(filename, clean_lines, line, error)
6365-
CheckScenarioHasTags(filename, clean_lines, line, error)
6364+
CheckCatchTestHasTags(filename, clean_lines, line, error)
63666365
CheckNamespaceOrUsing(filename, clean_lines, line, error)
63676366
CheckForEndl(filename, clean_lines, line, error)
63686367
for check_fn in extra_check_functions:

0 commit comments

Comments
 (0)