"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googlemock/test/gmock_output_test.py" between
googletest-release-1.11.0.tar.gz and googletest-release-1.12.0.tar.gz

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

gmock_output_test.py  (googletest-release-1.11.0):gmock_output_test.py  (googletest-release-1.12.0)
skipping to change at line 46 skipping to change at line 46
where BUILD/DIR contains the built gmock_output_test_ file. where BUILD/DIR contains the built gmock_output_test_ file.
gmock_output_test.py --gengolden gmock_output_test.py --gengolden
gmock_output_test.py gmock_output_test.py
""" """
from io import open # pylint: disable=redefined-builtin, g-importing-member from io import open # pylint: disable=redefined-builtin, g-importing-member
import os import os
import re import re
import sys import sys
import gmock_test_utils from googlemock.test import gmock_test_utils
# The flag for generating the golden file # The flag for generating the golden file
GENGOLDEN_FLAG = '--gengolden' GENGOLDEN_FLAG = '--gengolden'
PROGRAM_PATH = gmock_test_utils.GetTestExecutablePath('gmock_output_test_') PROGRAM_PATH = gmock_test_utils.GetTestExecutablePath('gmock_output_test_')
COMMAND = [PROGRAM_PATH, '--gtest_stack_trace_depth=0', '--gtest_print_time=0'] COMMAND = [PROGRAM_PATH, '--gtest_stack_trace_depth=0', '--gtest_print_time=0']
GOLDEN_NAME = 'gmock_output_test_golden.txt' GOLDEN_NAME = 'gmock_output_test_golden.txt'
GOLDEN_PATH = os.path.join(gmock_test_utils.GetSourceDir(), GOLDEN_NAME) GOLDEN_PATH = os.path.join(gmock_test_utils.GetSourceDir(), GOLDEN_NAME)
def ToUnixLineEnding(s): def ToUnixLineEnding(s):
skipping to change at line 152 skipping to change at line 152
class GMockOutputTest(gmock_test_utils.TestCase): class GMockOutputTest(gmock_test_utils.TestCase):
def testOutput(self): def testOutput(self):
(output, leaky_tests) = GetNormalizedCommandOutputAndLeakyTests(COMMAND) (output, leaky_tests) = GetNormalizedCommandOutputAndLeakyTests(COMMAND)
golden_file = open(GOLDEN_PATH, 'rb') golden_file = open(GOLDEN_PATH, 'rb')
golden = golden_file.read().decode('utf-8') golden = golden_file.read().decode('utf-8')
golden_file.close() golden_file.close()
# The normalized output should match the golden file. # The normalized output should match the golden file.
self.assertEquals(golden, output) self.assertEqual(golden, output)
# The raw output should contain 2 leaked mock object errors for # The raw output should contain 2 leaked mock object errors for
# test GMockOutputTest.CatchesLeakedMocks. # test GMockOutputTest.CatchesLeakedMocks.
self.assertEquals(['GMockOutputTest.CatchesLeakedMocks', self.assertEqual(['GMockOutputTest.CatchesLeakedMocks',
'GMockOutputTest.CatchesLeakedMocks'], 'GMockOutputTest.CatchesLeakedMocks'],
leaky_tests) leaky_tests)
if __name__ == '__main__': if __name__ == '__main__':
if sys.argv[1:] == [GENGOLDEN_FLAG]: if sys.argv[1:] == [GENGOLDEN_FLAG]:
(output, _) = GetNormalizedCommandOutputAndLeakyTests(COMMAND) (output, _) = GetNormalizedCommandOutputAndLeakyTests(COMMAND)
golden_file = open(GOLDEN_PATH, 'wb') golden_file = open(GOLDEN_PATH, 'wb')
golden_file.write(output) golden_file.write(output)
golden_file.close() golden_file.close()
# Suppress the error "googletest was imported but a call to its main() # Suppress the error "googletest was imported but a call to its main()
# was never detected." # was never detected."
os._exit(0) os._exit(0)
 End of changes. 3 change blocks. 
5 lines changed or deleted 5 lines changed or added

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