From c45ffc8562246bddd9e8519b157cff831f05d419 Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 9 Aug 2023 23:30:12 +0200 Subject: [PATCH 1/2] fixture.h: removed redundant reset of `mVerbose` - already done in `prepareTest()` --- test/fixture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixture.h b/test/fixture.h index 788b301c542..e08956d4b1a 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -319,7 +319,7 @@ class TestInstance { std::unique_ptr impl; }; -#define TEST_CASE( NAME ) do { if (prepareTest(#NAME)) { setVerbose(false); try { NAME(); teardownTest(); } catch (const AssertFailedError&) {} catch (...) { assertNoThrowFail(__FILE__, __LINE__, false); } } } while (false) +#define TEST_CASE( NAME ) do { if (prepareTest(#NAME)) { try { NAME(); teardownTest(); } catch (const AssertFailedError&) {} catch (...) { assertNoThrowFail(__FILE__, __LINE__, false); } } } while (false) #define ASSERT( CONDITION ) assert_(__FILE__, __LINE__, (CONDITION)) #define ASSERT_MSG( CONDITION, MSG ) assert_(__FILE__, __LINE__, (CONDITION), MSG) From 4ecf40fb1ffc4509bea568d4489a3147ee2b2497 Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 22 Sep 2025 14:29:12 +0200 Subject: [PATCH 2/2] removed unused `TestFixture::mVerbose` --- test/fixture.cpp | 3 +-- test/fixture.h | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/test/fixture.cpp b/test/fixture.cpp index fc285294a41..5585ab58b58 100644 --- a/test/fixture.cpp +++ b/test/fixture.cpp @@ -92,7 +92,6 @@ TestFixture::TestFixture(const char * const _name) bool TestFixture::prepareTest(const char testname[]) { - mVerbose = false; mTemplateFormat.clear(); mTemplateLocation.clear(); CppCheck::resetTimerResults(); @@ -439,7 +438,7 @@ void TestFixture::reportErr(const ErrorMessage &msg) return; std::string errormessage; if (!mTemplateFormat.empty()) { - errormessage = msg.toString(mVerbose, mTemplateFormat, mTemplateLocation); + errormessage = msg.toString(false, mTemplateFormat, mTemplateLocation); } else { if (!msg.callStack.empty()) { diff --git a/test/fixture.h b/test/fixture.h index e08956d4b1a..ebbb3eaa1a7 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -51,7 +51,6 @@ class TestFixture : public ErrorLogger { static std::size_t fails_counter; static std::size_t todos_counter; static std::size_t succeeded_todos_counter; - bool mVerbose{}; std::string mTemplateFormat; std::string mTemplateLocation; std::string mTestname; @@ -124,10 +123,6 @@ class TestFixture : public ErrorLogger { void assertNoThrowFail(const char * filename, unsigned int linenr, bool bailout) const; static std::string deleteLineNumber(const std::string &message); - void setVerbose(bool v) { - mVerbose = v; - } - void setTemplateFormat(const std::string &templateFormat); void setMultiline() {