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

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

Issue 2477813002: Fixing how --gtest-filter-file handles negative patterns. (Closed)
Patch Set: Converted a comment into a doc string. Created 4 years, 1 month 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 '[ CRASHED ]', 158 '[ CRASHED ]',
159 '[ OK ] FooTest.Bar (1 ms)', 159 '[ OK ] FooTest.Bar (1 ms)',
160 ] 160 ]
161 actual = gtest_test_instance.ParseGTestOutput(raw_output) 161 actual = gtest_test_instance.ParseGTestOutput(raw_output)
162 self.assertEquals(1, len(actual)) 162 self.assertEquals(1, len(actual))
163 163
164 self.assertEquals('FooTest.Bar', actual[0].GetName()) 164 self.assertEquals('FooTest.Bar', actual[0].GetName())
165 self.assertEquals(1, actual[0].GetDuration()) 165 self.assertEquals(1, actual[0].GetDuration())
166 self.assertEquals(base_test_result.ResultType.PASS, actual[0].GetType()) 166 self.assertEquals(base_test_result.ResultType.PASS, actual[0].GetType())
167 167
168 def testConvertTestFilterFile_commentsAndBlankLines(self):
169 input_lines = [
170 'positive1',
171 '# comment',
172 'positive2',
173 ''
174 'positive3'
175 ]
176 actual = gtest_test_instance \
177 .ConvertTestFilterFileIntoGTestFilterArgument(input_lines)
178 expected = 'positive1:positive2:positive3'
179 self.assertEquals(expected, actual)
180
181 def testConvertTestFilterFile_onlyPositive(self):
182 input_lines = [
183 'positive1',
184 'positive2'
185 ]
186 actual = gtest_test_instance \
187 .ConvertTestFilterFileIntoGTestFilterArgument(input_lines)
188 expected = 'positive1:positive2'
189 self.assertEquals(expected, actual)
190
191 def testConvertTestFilterFile_onlyNegative(self):
192 input_lines = [
193 '-negative1',
194 '-negative2'
195 ]
196 actual = gtest_test_instance \
197 .ConvertTestFilterFileIntoGTestFilterArgument(input_lines)
198 expected = '-negative1:negative2'
199 self.assertEquals(expected, actual)
200
201 def testConvertTestFilterFile_positiveAndNegative(self):
202 input_lines = [
203 'positive1',
204 'positive2',
205 '-negative1',
206 '-negative2'
207 ]
208 actual = gtest_test_instance \
209 .ConvertTestFilterFileIntoGTestFilterArgument(input_lines)
210 expected = 'positive1:positive2-negative1:negative2'
211 self.assertEquals(expected, actual)
212
168 213
169 if __name__ == '__main__': 214 if __name__ == '__main__':
170 unittest.main(verbosity=2) 215 unittest.main(verbosity=2)
171 216
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