Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: build/android/pylib/gtest/gtest_test_instance_test.py

Issue 2582263003: [Android] Fix empty gtest test name parsing. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/gtest/gtest_test_instance.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import unittest 6 import unittest
7 7
8 from pylib.base import base_test_result 8 from pylib.base import base_test_result
9 from pylib.gtest import gtest_test_instance 9 from pylib.gtest import gtest_test_instance
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ' testWithValueParam/0 # GetParam() = 0', 74 ' testWithValueParam/0 # GetParam() = 0',
75 ' testWithValueParam/1 # GetParam() = 1', 75 ' testWithValueParam/1 # GetParam() = 1',
76 ] 76 ]
77 actual = gtest_test_instance.ParseGTestListTests(raw_output) 77 actual = gtest_test_instance.ParseGTestListTests(raw_output)
78 expected = [ 78 expected = [
79 'VPTestCase.testWithValueParam/0', 79 'VPTestCase.testWithValueParam/0',
80 'VPTestCase.testWithValueParam/1', 80 'VPTestCase.testWithValueParam/1',
81 ] 81 ]
82 self.assertEqual(expected, actual) 82 self.assertEqual(expected, actual)
83 83
84 def testParseGTestListTests_emptyTestName(self):
85 raw_output = [
86 'TestCase.',
87 ' ',
88 ' nonEmptyTestName',
89 ]
90 actual = gtest_test_instance.ParseGTestListTests(raw_output)
91 expected = [
92 'TestCase.nonEmptyTestName',
93 ]
94 self.assertEqual(expected, actual)
95
84 def testParseGTestOutput_pass(self): 96 def testParseGTestOutput_pass(self):
85 raw_output = [ 97 raw_output = [
86 '[ RUN ] FooTest.Bar', 98 '[ RUN ] FooTest.Bar',
87 '[ OK ] FooTest.Bar (1 ms)', 99 '[ OK ] FooTest.Bar (1 ms)',
88 ] 100 ]
89 actual = gtest_test_instance.ParseGTestOutput(raw_output) 101 actual = gtest_test_instance.ParseGTestOutput(raw_output)
90 self.assertEquals(1, len(actual)) 102 self.assertEquals(1, len(actual))
91 self.assertEquals('FooTest.Bar', actual[0].GetName()) 103 self.assertEquals('FooTest.Bar', actual[0].GetName())
92 self.assertEquals(1, actual[0].GetDuration()) 104 self.assertEquals(1, actual[0].GetDuration())
93 self.assertEquals(base_test_result.ResultType.PASS, actual[0].GetType()) 105 self.assertEquals(base_test_result.ResultType.PASS, actual[0].GetType())
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 test_name = 'A.B' 250 test_name = 'A.B'
239 actual = gtest_test_instance \ 251 actual = gtest_test_instance \
240 .TestNameWithoutDisabledPrefix(test_name) 252 .TestNameWithoutDisabledPrefix(test_name)
241 expected = 'A.B' 253 expected = 'A.B'
242 self.assertEquals(expected, actual) 254 self.assertEquals(expected, actual)
243 255
244 256
245 if __name__ == '__main__': 257 if __name__ == '__main__':
246 unittest.main(verbosity=2) 258 unittest.main(verbosity=2)
247 259
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/gtest_test_instance.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698