makes googlemock generator handle some class templates; pulls in gtest r662
diff --git a/test/gmock_leak_test.py b/test/gmock_leak_test.py
index 38ff9d0..997680c 100755
--- a/test/gmock_leak_test.py
+++ b/test/gmock_leak_test.py
@@ -42,48 +42,66 @@
TEST_WITH_ON_CALL = [PROGRAM_PATH, '--gtest_filter=*OnCall*']
TEST_MULTIPLE_LEAKS = [PROGRAM_PATH, '--gtest_filter=*MultipleLeaked*']
+environ = gmock_test_utils.environ
+SetEnvVar = gmock_test_utils.SetEnvVar
+
+# Tests in this file run a Google-Test-based test program and expect it
+# to terminate prematurely. Therefore they are incompatible with
+# the premature-exit-file protocol by design. Unset the
+# premature-exit filepath to prevent Google Test from creating
+# the file.
+SetEnvVar(gmock_test_utils.PREMATURE_EXIT_FILE_ENV_VAR, None)
+
class GMockLeakTest(gmock_test_utils.TestCase):
def testCatchesLeakedMockByDefault(self):
self.assertNotEqual(
0,
- gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL).exit_code)
+ gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL,
+ env=environ).exit_code)
self.assertNotEqual(
0,
- gmock_test_utils.Subprocess(TEST_WITH_ON_CALL).exit_code)
+ gmock_test_utils.Subprocess(TEST_WITH_ON_CALL,
+ env=environ).exit_code)
def testDoesNotCatchLeakedMockWhenDisabled(self):
self.assertEquals(
0,
gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL +
- ['--gmock_catch_leaked_mocks=0']).exit_code)
+ ['--gmock_catch_leaked_mocks=0'],
+ env=environ).exit_code)
self.assertEquals(
0,
gmock_test_utils.Subprocess(TEST_WITH_ON_CALL +
- ['--gmock_catch_leaked_mocks=0']).exit_code)
+ ['--gmock_catch_leaked_mocks=0'],
+ env=environ).exit_code)
def testCatchesLeakedMockWhenEnabled(self):
self.assertNotEqual(
0,
gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL +
- ['--gmock_catch_leaked_mocks']).exit_code)
+ ['--gmock_catch_leaked_mocks'],
+ env=environ).exit_code)
self.assertNotEqual(
0,
gmock_test_utils.Subprocess(TEST_WITH_ON_CALL +
- ['--gmock_catch_leaked_mocks']).exit_code)
+ ['--gmock_catch_leaked_mocks'],
+ env=environ).exit_code)
def testCatchesLeakedMockWhenEnabledWithExplictFlagValue(self):
self.assertNotEqual(
0,
gmock_test_utils.Subprocess(TEST_WITH_EXPECT_CALL +
- ['--gmock_catch_leaked_mocks=1']).exit_code)
+ ['--gmock_catch_leaked_mocks=1'],
+ env=environ).exit_code)
def testCatchesMultipleLeakedMocks(self):
self.assertNotEqual(
0,
gmock_test_utils.Subprocess(TEST_MULTIPLE_LEAKS +
- ['--gmock_catch_leaked_mocks']).exit_code)
+ ['--gmock_catch_leaked_mocks'],
+ env=environ).exit_code)
if __name__ == '__main__':
diff --git a/test/gmock_test_utils.py b/test/gmock_test_utils.py
index ac3d67a..20e3d3d 100755
--- a/test/gmock_test_utils.py
+++ b/test/gmock_test_utils.py
@@ -96,11 +96,12 @@
# Suppresses the "Invalid const name" lint complaint
# pylint: disable-msg=C6409
-# Exposes Subprocess from gtest_test_utils.
+# Exposes utilities from gtest_test_utils.
Subprocess = gtest_test_utils.Subprocess
-
-# Exposes TestCase from gtest_test_utils.
TestCase = gtest_test_utils.TestCase
+environ = gtest_test_utils.environ
+SetEnvVar = gtest_test_utils.SetEnvVar
+PREMATURE_EXIT_FILE_ENV_VAR = gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR
# pylint: enable-msg=C6409