diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 75da1a74..9d3d2e0d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -35,7 +35,7 @@ target_link_libraries(FakeIt_tests PRIVATE ) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$") - target_compile_options(FakeIt_tests PRIVATE -Wall -Wextra -Wno-ignored-qualifiers -Wno-uninitialized -O0 -g3) + target_compile_options(FakeIt_tests PRIVATE -Wall -Wextra -Wno-ignored-qualifiers -O0 -g3) elseif(MSVC) target_compile_options(FakeIt_tests PRIVATE /W3 /sdl /Od) endif() diff --git a/tests/tpunit++.hpp b/tests/tpunit++.hpp index c0e3aa3f..c0feeb64 100644 --- a/tests/tpunit++.hpp +++ b/tests/tpunit++.hpp @@ -155,11 +155,11 @@ * used by all test functions. * TEST(function); registers a function to run as a test within a test fixture. */ -#define AFTER(M) tpunit_detail_method(&M, #M, method::AFTER_METHOD) -#define AFTER_CLASS(M) tpunit_detail_method(&M, #M, method::AFTER_CLASS_METHOD) -#define BEFORE(M) tpunit_detail_method(&M, #M, method::BEFORE_METHOD) -#define BEFORE_CLASS(M) tpunit_detail_method(&M, #M, method::BEFORE_CLASS_METHOD) -#define TEST(M) tpunit_detail_method(&M, #M, method::TEST_METHOD) +#define AFTER(M) tpunit_detail_method(this, &M, #M, method::AFTER_METHOD) +#define AFTER_CLASS(M) tpunit_detail_method(this, &M, #M, method::AFTER_CLASS_METHOD) +#define BEFORE(M) tpunit_detail_method(this, &M, #M, method::BEFORE_METHOD) +#define BEFORE_CLASS(M) tpunit_detail_method(this, &M, #M, method::BEFORE_CLASS_METHOD) +#define TEST(M) tpunit_detail_method(this, &M, #M, method::TEST_METHOD) /** * Try our best to detect compiler support for exception handling so @@ -297,12 +297,14 @@ namespace tpunit { /** * Create a new method to register with the test fixture. * + * @param[in] obj The test fixture for which the new method will be registered. * @param[in] _method A method to register with the test fixture. * @param[in] _name The internal name of the method used when status messages are displayed. + * @param[in] _type The type of method to register. */ template - method* tpunit_detail_method(void (C::*_method)(), const char* _name, unsigned char _type) { - return new method(this, static_cast(_method), _name, _type); + static method* tpunit_detail_method(TestFixture* obj, void (C::*_method)(), const char* _name, unsigned char _type) { + return new method(obj, static_cast(_method), _name, _type); } /**