From 4987c035318536a76f3f5dd00beb417d8fb4b24c Mon Sep 17 00:00:00 2001 From: Eugene Siegel Date: Thu, 5 Jun 2025 13:47:49 -0400 Subject: [PATCH] test: Mark ~DebugLogHelper as noexcept(false) We mark ~DebugLogHelper as noexcept(false) to be able to catch the exception it throws. This lets us use it in test in combination with BOOST_CHECK_THROW and BOOST_CHECK_NO_THROW to check that certain log messages are (not) logged. Co-Authored-By: Niklas Gogge Github-Pull: #32604 Rebased-From: df7972a6cfd919b972bcbba07de85f7797898529 --- src/test/util/logging.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/util/logging.h b/src/test/util/logging.h index 73ac23825f9..5d7e4f91e0f 100644 --- a/src/test/util/logging.h +++ b/src/test/util/logging.h @@ -33,7 +33,9 @@ class DebugLogHelper public: explicit DebugLogHelper(std::string message, MatchFn match = [](const std::string*){ return true; }); - ~DebugLogHelper() { check_found(); } + + //! Mark as noexcept(false) to catch any thrown exceptions. + ~DebugLogHelper() noexcept(false) { check_found(); } }; #define ASSERT_DEBUG_LOG(message) DebugLogHelper UNIQUE_NAME(debugloghelper)(message)