sample10_unittest.cc (googletest-release-1.11.0) | : | sample10_unittest.cc (googletest-release-1.12.0) | ||
---|---|---|---|---|
skipping to change at line 106 | skipping to change at line 106 | |||
} | } | |||
// This should fail when the --check_for_leaks command line flag is | // This should fail when the --check_for_leaks command line flag is | |||
// specified. | // specified. | |||
TEST(ListenersTest, LeaksWater) { | TEST(ListenersTest, LeaksWater) { | |||
Water* water = new Water; | Water* water = new Water; | |||
EXPECT_TRUE(water != nullptr); | EXPECT_TRUE(water != nullptr); | |||
} | } | |||
} // namespace | } // namespace | |||
int main(int argc, char **argv) { | int main(int argc, char** argv) { | |||
InitGoogleTest(&argc, argv); | InitGoogleTest(&argc, argv); | |||
bool check_for_leaks = false; | bool check_for_leaks = false; | |||
if (argc > 1 && strcmp(argv[1], "--check_for_leaks") == 0 ) | if (argc > 1 && strcmp(argv[1], "--check_for_leaks") == 0) | |||
check_for_leaks = true; | check_for_leaks = true; | |||
else | else | |||
printf("%s\n", "Run this program with --check_for_leaks to enable " | printf("%s\n", | |||
"Run this program with --check_for_leaks to enable " | ||||
"custom leak checking in the tests."); | "custom leak checking in the tests."); | |||
// If we are given the --check_for_leaks command line flag, installs the | // If we are given the --check_for_leaks command line flag, installs the | |||
// leak checker. | // leak checker. | |||
if (check_for_leaks) { | if (check_for_leaks) { | |||
TestEventListeners& listeners = UnitTest::GetInstance()->listeners(); | TestEventListeners& listeners = UnitTest::GetInstance()->listeners(); | |||
// Adds the leak checker to the end of the test event listener list, | // Adds the leak checker to the end of the test event listener list, | |||
// after the default text output printer and the default XML report | // after the default text output printer and the default XML report | |||
// generator. | // generator. | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added |