Improves the error message for leaked mocks to include the test name (by Zhanyong Wan).
diff --git a/test/gmock_output_test_.cc b/test/gmock_output_test_.cc
index c97bc78..97619af 100644
--- a/test/gmock_output_test_.cc
+++ b/test/gmock_output_test_.cc
@@ -258,6 +258,16 @@
// 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 @@
testing::GMOCK_FLAG(catch_leaked_mocks) = true;
testing::GMOCK_FLAG(verbose) = "warning";
+ TestCatchesLeakedMocksInAdHocTests();
return RUN_ALL_TESTS();
}