[Android] Fix type-parameterized gtest parsing.

BUG=

Review URL: https://codereview.chromium.org/441023002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287701 0039d316-1c4b-4281-b951-d872f2087c98
parent 3ea5a0d7
...@@ -88,14 +88,11 @@ class TestPackage(object): ...@@ -88,14 +88,11 @@ class TestPackage(object):
for test in raw_list: for test in raw_list:
if not test: if not test:
continue continue
if test[0] != ' ' and not test.endswith('.'): if test[0] != ' ':
# Ignore any lines with unexpected format. test_case = test.split()[0]
continue if test_case.endswith('.'):
if test[0] != ' ' and test.endswith('.'): current = test_case
current = test elif not 'YOU HAVE' in test:
continue test_name = test.split()[0]
if 'YOU HAVE' in test: ret += [current + test_name]
break
test_name = test.split(None, 1)[0]
ret += [current + test_name]
return ret return ret
...@@ -30,29 +30,55 @@ class TestPackageTest(unittest.TestCase): ...@@ -30,29 +30,55 @@ class TestPackageTest(unittest.TestCase):
] ]
self.assertEqual(expected, actual) self.assertEqual(expected, actual)
def testParseGTestListTests_parameterized_old(self): def testParseGTestListTests_typeParameterized_old(self):
raw_output = [ raw_output = [
'PTestCase.', 'TPTestCase/WithTypeParam/0.',
' testOne',
' testTwo',
]
actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [
'TPTestCase/WithTypeParam/0.testOne',
'TPTestCase/WithTypeParam/0.testTwo',
]
self.assertEqual(expected, actual)
def testParseGTestListTests_typeParameterized_new(self):
raw_output = [
'TPTestCase/WithTypeParam/0. # TypeParam = TypeParam0',
' testOne',
' testTwo',
]
actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [
'TPTestCase/WithTypeParam/0.testOne',
'TPTestCase/WithTypeParam/0.testTwo',
]
self.assertEqual(expected, actual)
def testParseGTestListTests_valueParameterized_old(self):
raw_output = [
'VPTestCase.',
' testWithValueParam/0', ' testWithValueParam/0',
' testWithValueParam/1', ' testWithValueParam/1',
] ]
actual = test_package.TestPackage._ParseGTestListTests(raw_output) actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [ expected = [
'PTestCase.testWithValueParam/0', 'VPTestCase.testWithValueParam/0',
'PTestCase.testWithValueParam/1', 'VPTestCase.testWithValueParam/1',
] ]
self.assertEqual(expected, actual) self.assertEqual(expected, actual)
def testParseGTestListTests_parameterized_new(self): def testParseGTestListTests_valueParameterized_new(self):
raw_output = [ raw_output = [
'PTestCase.', 'VPTestCase.',
' testWithValueParam/0 # GetParam() = 0', ' testWithValueParam/0 # GetParam() = 0',
' testWithValueParam/1 # GetParam() = 1', ' testWithValueParam/1 # GetParam() = 1',
] ]
actual = test_package.TestPackage._ParseGTestListTests(raw_output) actual = test_package.TestPackage._ParseGTestListTests(raw_output)
expected = [ expected = [
'PTestCase.testWithValueParam/0', 'VPTestCase.testWithValueParam/0',
'PTestCase.testWithValueParam/1', 'VPTestCase.testWithValueParam/1',
] ]
self.assertEqual(expected, actual) self.assertEqual(expected, actual)
......
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