From 3069167dd476f09f2454bd5e61a3fa007fc5aa1d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Nov 2017 02:52:06 +0100 Subject: [PATCH] Do set the current test name when running the tests The variables and helper TempStringAssign class were added in order to implement this, but somehow it was never done, so wxGetCurrentTestName() always returned an empty string. Fix this and so store the class/method name of the currently running test in the global variables to give more context, notably for GTK+ errors. --- include/wx/catch_cppunit.h | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/include/wx/catch_cppunit.h b/include/wx/catch_cppunit.h index f9472b8446..22ebcf12f9 100644 --- a/include/wx/catch_cppunit.h +++ b/include/wx/catch_cppunit.h @@ -202,22 +202,24 @@ inline std::string wxGetCurrentTestName() public: \ void runTest() wxOVERRIDE \ { \ - struct EatNextSemicolon + using namespace wxPrivate; \ + TempStringAssign setClass(wxTheCurrentTestClass, #testclass) -#define CPPUNIT_TEST(testname) \ - SECTION(#testname) \ - { \ - setUp(); \ - try \ - { \ - testname(); \ - } \ - catch ( ... ) \ - { \ - tearDown(); \ - throw; \ - } \ - tearDown(); \ +#define CPPUNIT_TEST(testname) \ + SECTION(#testname) \ + { \ + TempStringAssign setMethod(wxTheCurrentTestMethod, #testname); \ + setUp(); \ + try \ + { \ + testname(); \ + } \ + catch ( ... ) \ + { \ + tearDown(); \ + throw; \ + } \ + tearDown(); \ } #define CPPUNIT_TEST_SUITE_END() \