Skip to content

Commit 4987c03

Browse files
Crypt-iQfanquake
authored andcommitted
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 <[email protected]> Github-Pull: #32604 Rebased-From: df7972a
1 parent 837c5c7 commit 4987c03

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/test/util/logging.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ class DebugLogHelper
3333

3434
public:
3535
explicit DebugLogHelper(std::string message, MatchFn match = [](const std::string*){ return true; });
36-
~DebugLogHelper() { check_found(); }
36+
37+
//! Mark as noexcept(false) to catch any thrown exceptions.
38+
~DebugLogHelper() noexcept(false) { check_found(); }
3739
};
3840

3941
#define ASSERT_DEBUG_LOG(message) DebugLogHelper UNIQUE_NAME(debugloghelper)(message)

0 commit comments

Comments
 (0)