Improves the error message for leaked mocks to include the test name (by Zhanyong Wan).

This commit is contained in:
zhanyong.wan
2009-05-05 23:14:47 +00:00
parent 125783fb87
commit e7bb5ededa
5 changed files with 74 additions and 16 deletions

View File

@@ -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();
}