File indexing completed on 2025-01-18 09:54:04
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_ASSERTION_HANDLER_HPP_INCLUDED
0009 #define CATCH_ASSERTION_HANDLER_HPP_INCLUDED
0010
0011 #include <catch2/catch_assertion_info.hpp>
0012 #include <catch2/internal/catch_decomposer.hpp>
0013 #include <catch2/interfaces/catch_interfaces_capture.hpp>
0014
0015 #include <string>
0016
0017 namespace Catch {
0018
0019 struct AssertionReaction {
0020 bool shouldDebugBreak = false;
0021 bool shouldThrow = false;
0022 bool shouldSkip = false;
0023 };
0024
0025 class AssertionHandler {
0026 AssertionInfo m_assertionInfo;
0027 AssertionReaction m_reaction;
0028 bool m_completed = false;
0029 IResultCapture& m_resultCapture;
0030
0031 public:
0032 AssertionHandler
0033 ( StringRef macroName,
0034 SourceLineInfo const& lineInfo,
0035 StringRef capturedExpression,
0036 ResultDisposition::Flags resultDisposition );
0037 ~AssertionHandler() {
0038 if ( !m_completed ) {
0039 m_resultCapture.handleIncomplete( m_assertionInfo );
0040 }
0041 }
0042
0043
0044 template<typename T>
0045 void handleExpr( ExprLhs<T> const& expr ) {
0046 handleExpr( expr.makeUnaryExpr() );
0047 }
0048 void handleExpr( ITransientExpression const& expr );
0049
0050 void handleMessage(ResultWas::OfType resultType, StringRef message);
0051
0052 void handleExceptionThrownAsExpected();
0053 void handleUnexpectedExceptionNotThrown();
0054 void handleExceptionNotThrownAsExpected();
0055 void handleThrowingCallSkipped();
0056 void handleUnexpectedInflightException();
0057
0058 void complete();
0059
0060
0061 auto allowThrows() const -> bool;
0062 };
0063
0064 void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str );
0065
0066 }
0067
0068 #endif