"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googletest/test/gtest_list_output_unittest.py" between
googletest-release-1.10.0.tar.gz and googletest-release-1.11.0.tar.gz

About: GoogleTest is Google's (unit) testing and mocking framework for C++ tests.

gtest_list_output_unittest.py  (googletest-release-1.10.0):gtest_list_output_unittest.py  (googletest-release-1.11.0)
skipping to change at line 49 skipping to change at line 49
""" """
import os import os
import re import re
import gtest_test_utils import gtest_test_utils
GTEST_LIST_TESTS_FLAG = '--gtest_list_tests' GTEST_LIST_TESTS_FLAG = '--gtest_list_tests'
GTEST_OUTPUT_FLAG = '--gtest_output' GTEST_OUTPUT_FLAG = '--gtest_output'
EXPECTED_XML = """<\?xml version="1.0" encoding="UTF-8"\?> EXPECTED_XML = """<\?xml version="1.0" encoding="UTF-8"\?>
<testsuites tests="2" name="AllTests"> <testsuites tests="16" name="AllTests">
<testsuite name="FooTest" tests="2"> <testsuite name="FooTest" tests="2">
<testcase name="Test1" file=".*gtest_list_output_unittest_.cc" line="43" /> <testcase name="Test1" file=".*gtest_list_output_unittest_.cc" line="43" />
<testcase name="Test2" file=".*gtest_list_output_unittest_.cc" line="45" /> <testcase name="Test2" file=".*gtest_list_output_unittest_.cc" line="45" />
</testsuite> </testsuite>
<testsuite name="FooTestFixture" tests="2">
<testcase name="Test3" file=".*gtest_list_output_unittest_.cc" line="48" />
<testcase name="Test4" file=".*gtest_list_output_unittest_.cc" line="49" />
</testsuite>
<testsuite name="TypedTest/0" tests="2">
<testcase name="Test7" type_param="int" file=".*gtest_list_output_unittest_.
cc" line="60" />
<testcase name="Test8" type_param="int" file=".*gtest_list_output_unittest_.
cc" line="61" />
</testsuite>
<testsuite name="TypedTest/1" tests="2">
<testcase name="Test7" type_param="bool" file=".*gtest_list_output_unittest_
.cc" line="60" />
<testcase name="Test8" type_param="bool" file=".*gtest_list_output_unittest_
.cc" line="61" />
</testsuite>
<testsuite name="Single/TypeParameterizedTestSuite/0" tests="2">
<testcase name="Test9" type_param="int" file=".*gtest_list_output_unittest_.
cc" line="66" />
<testcase name="Test10" type_param="int" file=".*gtest_list_output_unittest_
.cc" line="67" />
</testsuite>
<testsuite name="Single/TypeParameterizedTestSuite/1" tests="2">
<testcase name="Test9" type_param="bool" file=".*gtest_list_output_unittest_
.cc" line="66" />
<testcase name="Test10" type_param="bool" file=".*gtest_list_output_unittest
_.cc" line="67" />
</testsuite>
<testsuite name="ValueParam/ValueParamTest" tests="4">
<testcase name="Test5/0" value_param="33" file=".*gtest_list_output_unittest
_.cc" line="52" />
<testcase name="Test5/1" value_param="42" file=".*gtest_list_output_unittest
_.cc" line="52" />
<testcase name="Test6/0" value_param="33" file=".*gtest_list_output_unittest
_.cc" line="53" />
<testcase name="Test6/1" value_param="42" file=".*gtest_list_output_unittest
_.cc" line="53" />
</testsuite>
</testsuites> </testsuites>
""" """
EXPECTED_JSON = """{ EXPECTED_JSON = """{
"tests": 2, "tests": 16,
"name": "AllTests", "name": "AllTests",
"testsuites": \[ "testsuites": \[
{ {
"name": "FooTest", "name": "FooTest",
"tests": 2, "tests": 2,
"testsuite": \[ "testsuite": \[
{ {
"name": "Test1", "name": "Test1",
"file": ".*gtest_list_output_unittest_.cc", "file": ".*gtest_list_output_unittest_.cc",
"line": 43 "line": 43
}, },
{ {
"name": "Test2", "name": "Test2",
"file": ".*gtest_list_output_unittest_.cc", "file": ".*gtest_list_output_unittest_.cc",
"line": 45 "line": 45
} }
\] \]
},
{
"name": "FooTestFixture",
"tests": 2,
"testsuite": \[
{
"name": "Test3",
"file": ".*gtest_list_output_unittest_.cc",
"line": 48
},
{
"name": "Test4",
"file": ".*gtest_list_output_unittest_.cc",
"line": 49
}
\]
},
{
"name": "TypedTest\\\\/0",
"tests": 2,
"testsuite": \[
{
"name": "Test7",
"type_param": "int",
"file": ".*gtest_list_output_unittest_.cc",
"line": 60
},
{
"name": "Test8",
"type_param": "int",
"file": ".*gtest_list_output_unittest_.cc",
"line": 61
}
\]
},
{
"name": "TypedTest\\\\/1",
"tests": 2,
"testsuite": \[
{
"name": "Test7",
"type_param": "bool",
"file": ".*gtest_list_output_unittest_.cc",
"line": 60
},
{
"name": "Test8",
"type_param": "bool",
"file": ".*gtest_list_output_unittest_.cc",
"line": 61
}
\]
},
{
"name": "Single\\\\/TypeParameterizedTestSuite\\\\/0",
"tests": 2,
"testsuite": \[
{
"name": "Test9",
"type_param": "int",
"file": ".*gtest_list_output_unittest_.cc",
"line": 66
},
{
"name": "Test10",
"type_param": "int",
"file": ".*gtest_list_output_unittest_.cc",
"line": 67
}
\]
},
{
"name": "Single\\\\/TypeParameterizedTestSuite\\\\/1",
"tests": 2,
"testsuite": \[
{
"name": "Test9",
"type_param": "bool",
"file": ".*gtest_list_output_unittest_.cc",
"line": 66
},
{
"name": "Test10",
"type_param": "bool",
"file": ".*gtest_list_output_unittest_.cc",
"line": 67
}
\]
},
{
"name": "ValueParam\\\\/ValueParamTest",
"tests": 4,
"testsuite": \[
{
"name": "Test5\\\\/0",
"value_param": "33",
"file": ".*gtest_list_output_unittest_.cc",
"line": 52
},
{
"name": "Test5\\\\/1",
"value_param": "42",
"file": ".*gtest_list_output_unittest_.cc",
"line": 52
},
{
"name": "Test6\\\\/0",
"value_param": "33",
"file": ".*gtest_list_output_unittest_.cc",
"line": 53
},
{
"name": "Test6\\\\/1",
"value_param": "42",
"file": ".*gtest_list_output_unittest_.cc",
"line": 53
}
\]
} }
\] \]
} }
""" """
class GTestListTestsOutputUnitTest(gtest_test_utils.TestCase): class GTestListTestsOutputUnitTest(gtest_test_utils.TestCase):
"""Unit test for Google Test's list tests with output to file functionality. """Unit test for Google Test's list tests with output to file functionality.
""" """
def testXml(self): def testXml(self):
skipping to change at line 116 skipping to change at line 260
command = ([ command = ([
gtest_prog_path, gtest_prog_path,
'%s=%s:%s' % (GTEST_OUTPUT_FLAG, out_format, file_path), '%s=%s:%s' % (GTEST_OUTPUT_FLAG, out_format, file_path),
'--gtest_list_tests' '--gtest_list_tests'
]) ])
environ_copy = os.environ.copy() environ_copy = os.environ.copy()
p = gtest_test_utils.Subprocess( p = gtest_test_utils.Subprocess(
command, env=environ_copy, working_dir=gtest_test_utils.GetTempDir()) command, env=environ_copy, working_dir=gtest_test_utils.GetTempDir())
self.assert_(p.exited) self.assertTrue(p.exited)
self.assertEquals(0, p.exit_code) self.assertEqual(0, p.exit_code)
self.assertTrue(os.path.isfile(file_path))
with open(file_path) as f: with open(file_path) as f:
result = f.read() result = f.read()
return result return result
def _TestOutput(self, test_format, expected_output): def _TestOutput(self, test_format, expected_output):
actual = self._GetOutput(test_format) actual = self._GetOutput(test_format)
actual_lines = actual.splitlines() actual_lines = actual.splitlines()
expected_lines = expected_output.splitlines() expected_lines = expected_output.splitlines()
line_count = 0 line_count = 0
for actual_line in actual_lines: for actual_line in actual_lines:
expected_line = expected_lines[line_count] expected_line = expected_lines[line_count]
expected_line_re = re.compile(expected_line.strip()) expected_line_re = re.compile(expected_line.strip())
self.assert_( self.assertTrue(
expected_line_re.match(actual_line.strip()), expected_line_re.match(actual_line.strip()),
('actual output of "%s",\n' ('actual output of "%s",\n'
'which does not match expected regex of "%s"\n' 'which does not match expected regex of "%s"\n'
'on line %d' % (actual, expected_output, line_count))) 'on line %d' % (actual, expected_output, line_count)))
line_count = line_count + 1 line_count = line_count + 1
if __name__ == '__main__': if __name__ == '__main__':
os.environ['GTEST_STACK_TRACE_DEPTH'] = '1' os.environ['GTEST_STACK_TRACE_DEPTH'] = '1'
gtest_test_utils.Main() gtest_test_utils.Main()
 End of changes. 6 change blocks. 
5 lines changed or deleted 162 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)