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

Side by Side Diff: mojo/tools/mopy/gtest_list_tests_unittest.py

Issue 878933003: Move the apptest runner and parts of mopy to the public SDK. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 months 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 | « mojo/tools/mopy/gtest.py ('k') | mojo/tools/mopy/memoize.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 from mopy.gtest import _gtest_list_tests
8
9 class GTestListTestsTest(unittest.TestCase):
10 """Tests |_gtest_list_tests()| handling of --gtest_list_tests output."""
11
12 def testSingleSuiteAndFixture(self):
13 """Tests a single suite with a single fixture."""
14 gtest_output = "TestSuite.\n TestFixture\n"
15 expected_test_list = ["TestSuite.TestFixture"]
16 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
17
18 def testWindowsNewlines(self):
19 """Tests handling of \r\n newlines."""
20 gtest_output = "TestSuite.\r\n TestFixture1\r\n"
21 expected_test_list = ["TestSuite.TestFixture1"]
22 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
23
24 def testSingleSuiteAndMultipleFixtures(self):
25 """Tests a single suite with multiple fixtures."""
26 gtest_output = "TestSuite.\n TestFixture1\n TestFixture2\n"
27 expected_test_list = ["TestSuite.TestFixture1", "TestSuite.TestFixture2"]
28 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
29
30 def testMultipleSuitesAndFixtures(self):
31 """Tests multiple suites each with multiple fixtures."""
32 gtest_output = ("TestSuite1.\n TestFixture1\n TestFixture2\n"
33 "TestSuite2.\n TestFixtureA\n TestFixtureB\n")
34 expected_test_list = ["TestSuite1.TestFixture1", "TestSuite1.TestFixture2",
35 "TestSuite2.TestFixtureA", "TestSuite2.TestFixtureB"]
36 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
37
38 def testUnrecognizedFormats(self):
39 """Tests examples of unrecognized --gtest_list_tests output."""
40 self.assertRaises(Exception, _gtest_list_tests, "Foo")
41 self.assertRaises(Exception, _gtest_list_tests, "Foo\n")
42 self.assertRaises(Exception, _gtest_list_tests, "Foo.Bar\n")
43 self.assertRaises(Exception, _gtest_list_tests, "Foo.\nBar\n")
44 self.assertRaises(Exception, _gtest_list_tests, "Foo.\r\nBar\r\nGaz\r\n")
45 self.assertRaises(Exception, _gtest_list_tests, "Foo.\nBar.\n Gaz\n")
46
47
48 if __name__ == "__main__":
49 unittest.main()
OLDNEW
« no previous file with comments | « mojo/tools/mopy/gtest.py ('k') | mojo/tools/mopy/memoize.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698