diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-05-05 23:14:47 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-05-05 23:14:47 +0000 |
commit | e7bb5ededa4df6ec430c1e84154bc01bf84d4ecc (patch) | |
tree | 26a95c5d0237def74e51c633877d5cfc308db19d /test/gmock_output_test_.cc | |
parent | 125783fb87488239c062422bece2a9302489aafd (diff) | |
download | googletest-e7bb5ededa4df6ec430c1e84154bc01bf84d4ecc.tar.gz googletest-e7bb5ededa4df6ec430c1e84154bc01bf84d4ecc.tar.bz2 googletest-e7bb5ededa4df6ec430c1e84154bc01bf84d4ecc.zip |
Improves the error message for leaked mocks to include the test name (by Zhanyong Wan).
Diffstat (limited to 'test/gmock_output_test_.cc')
-rw-r--r-- | test/gmock_output_test_.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/gmock_output_test_.cc b/test/gmock_output_test_.cc index c97bc78c..97619af1 100644 --- a/test/gmock_output_test_.cc +++ b/test/gmock_output_test_.cc @@ -258,6 +258,16 @@ TEST_F(GMockOutputTest, CatchesLeakedMocks) { // Both foo1 and foo2 are deliberately leaked. } +void TestCatchesLeakedMocksInAdHocTests() { + MockFoo* foo = new MockFoo; + + // Invokes EXPECT_CALL on foo. + EXPECT_CALL(*foo, Bar2(_, _)); + foo->Bar2(2, 1); + + // foo is deliberately leaked. +} + int main(int argc, char **argv) { testing::InitGoogleMock(&argc, argv); @@ -266,5 +276,6 @@ int main(int argc, char **argv) { testing::GMOCK_FLAG(catch_leaked_mocks) = true; testing::GMOCK_FLAG(verbose) = "warning"; + TestCatchesLeakedMocksInAdHocTests(); return RUN_ALL_TESTS(); } |