Commit ef60bcc9 authored by jbudorick's avatar jbudorick Committed by Commit bot

[Android] Fix empty gtest test name parsing.

Last week, a CL landed that contained a gtest with an empty test name,
e.g.

  TEST(FooTest, )

This broke our gtest-list-tests parsing logic because it saw this:

  FooTest.

    testBar

and incorrectly handled the line containing only spaces. This patch
fixes the handling of that case.

Review-Url: https://codereview.chromium.org/2582263003
Cr-Commit-Position: refs/heads/master@{#439507}
parent bbfdf051
......@@ -99,11 +99,13 @@ def ParseGTestListTests(raw_list):
for test in raw_list:
if not test:
continue
if test[0] != ' ':
if not test.startswith(' '):
test_case = test.split()[0]
if test_case.endswith('.'):
current = test_case
elif not 'YOU HAVE' in test:
else:
test = test.strip()
if test and not 'YOU HAVE' in test:
test_name = test.split()[0]
ret += [current + test_name]
return ret
......
......@@ -81,6 +81,18 @@ class GtestTestInstanceTests(unittest.TestCase):
]
self.assertEqual(expected, actual)
def testParseGTestListTests_emptyTestName(self):
raw_output = [
'TestCase.',
' ',
' nonEmptyTestName',
]
actual = gtest_test_instance.ParseGTestListTests(raw_output)
expected = [
'TestCase.nonEmptyTestName',
]
self.assertEqual(expected, actual)
def testParseGTestOutput_pass(self):
raw_output = [
'[ RUN ] FooTest.Bar',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment