From e26601672e4e6016bead4895a8cf692a9c74b800 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 6 Jan 2022 15:24:46 +0100 Subject: [PATCH] Remove ASSERT_VERIFY_FAIL macro from static_objects_problem --- doc/example/patterns_static_objects.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/example/patterns_static_objects.cpp b/doc/example/patterns_static_objects.cpp index d5e198e..7918531 100644 --- a/doc/example/patterns_static_objects.cpp +++ b/doc/example/patterns_static_objects.cpp @@ -6,8 +6,15 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Used to make this test file pass. Define to empty to see other tests fail -#define ASSERT_VERIFY_FAIL() mock::reset() +#include + +// Used to make this test file pass. Define to 0 to see other tests fail +#define MOCK_MAKE_TEST_PASS 1 + +#if MOCK_MAKE_TEST_PASS +#undef BOOST_AUTO_TEST_CASE +#define BOOST_AUTO_TEST_CASE(name) BOOST_FIXTURE_TEST_CASE(name, mock::cleanup) +#endif //[ static_objects_problem #include @@ -36,7 +43,6 @@ BOOST_AUTO_TEST_CASE( static_objects_problem ) { my_class c( 42 ); MOCK_EXPECT( f ).once().with( &c ); // the set expectation will also outlive the test case and leak into other test cases using 'f' - ASSERT_VERIFY_FAIL(); // Check that mock::verify fails, but that means other test fail too } // the 'c' instance goes out of scope and the '&c' pointer becomes dangling //]