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

Side by Side Diff: mojo/devtools/common/pylib/apptest_gtest_unittest.py

Issue 1128153002: Rename the devtools library: pylib -> devtoolslib. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address offline comments/ devtools_lib -> devtoolslib. Created 5 years, 7 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/devtools/common/pylib/apptest_gtest.py ('k') | mojo/devtools/common/pylib/http_server.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 imp
6 import os.path
7 import sys
8 import unittest
9
10 try:
11 imp.find_module("pylib")
12 except ImportError:
13 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
14 from pylib.apptest_gtest import _gtest_list_tests
15
16
17 class GTestListTestsTest(unittest.TestCase):
18 """Tests |_gtest_list_tests()| handling of --gtest_list_tests output."""
19
20 def testSingleSuiteAndFixture(self):
21 """Tests a single suite with a single fixture."""
22 gtest_output = "TestSuite.\n TestFixture\n"
23 expected_test_list = ["TestSuite.TestFixture"]
24 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
25
26 def testWindowsNewlines(self):
27 """Tests handling of \r\n newlines."""
28 gtest_output = "TestSuite.\r\n TestFixture1\r\n"
29 expected_test_list = ["TestSuite.TestFixture1"]
30 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
31
32 def testSingleSuiteAndMultipleFixtures(self):
33 """Tests a single suite with multiple fixtures."""
34 gtest_output = "TestSuite.\n TestFixture1\n TestFixture2\n"
35 expected_test_list = ["TestSuite.TestFixture1", "TestSuite.TestFixture2"]
36 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
37
38 def testMultipleSuitesAndFixtures(self):
39 """Tests multiple suites each with multiple fixtures."""
40 gtest_output = ("TestSuite1.\n TestFixture1\n TestFixture2\n"
41 "TestSuite2.\n TestFixtureA\n TestFixtureB\n")
42 expected_test_list = ["TestSuite1.TestFixture1", "TestSuite1.TestFixture2",
43 "TestSuite2.TestFixtureA", "TestSuite2.TestFixtureB"]
44 self.assertEquals(_gtest_list_tests(gtest_output), expected_test_list)
45
46 def testUnrecognizedFormats(self):
47 """Tests examples of unrecognized --gtest_list_tests output."""
48 self.assertRaises(Exception, _gtest_list_tests, "Foo")
49 self.assertRaises(Exception, _gtest_list_tests, "Foo\n")
50 self.assertRaises(Exception, _gtest_list_tests, "Foo.Bar\n")
51 self.assertRaises(Exception, _gtest_list_tests, "Foo.\nBar\n")
52 self.assertRaises(Exception, _gtest_list_tests, "Foo.\r\nBar\r\nGaz\r\n")
53 self.assertRaises(Exception, _gtest_list_tests, "Foo.\nBar.\n Gaz\n")
54
55
56 if __name__ == "__main__":
57 unittest.main()
OLDNEW
« no previous file with comments | « mojo/devtools/common/pylib/apptest_gtest.py ('k') | mojo/devtools/common/pylib/http_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698