line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
// Copyright Catch2 Authors |
3
|
|
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. |
4
|
|
|
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at |
5
|
|
|
|
|
|
|
// https://www.boost.org/LICENSE_1_0.txt) |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
// SPDX-License-Identifier: BSL-1.0 |
8
|
|
|
|
|
|
|
#ifndef CATCH_ASSERTION_HANDLER_HPP_INCLUDED |
9
|
|
|
|
|
|
|
#define CATCH_ASSERTION_HANDLER_HPP_INCLUDED |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#include |
12
|
|
|
|
|
|
|
#include |
13
|
|
|
|
|
|
|
#include |
14
|
|
|
|
|
|
|
#include |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
namespace Catch { |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
struct AssertionResultData; |
19
|
|
|
|
|
|
|
struct IResultCapture; |
20
|
|
|
|
|
|
|
class RunContext; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
struct AssertionReaction { |
23
|
|
|
|
|
|
|
bool shouldDebugBreak = false; |
24
|
|
|
|
|
|
|
bool shouldThrow = false; |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
class AssertionHandler { |
28
|
|
|
|
|
|
|
AssertionInfo m_assertionInfo; |
29
|
|
|
|
|
|
|
AssertionReaction m_reaction; |
30
|
|
|
|
|
|
|
bool m_completed = false; |
31
|
|
|
|
|
|
|
IResultCapture& m_resultCapture; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
public: |
34
|
|
|
|
|
|
|
AssertionHandler |
35
|
|
|
|
|
|
|
( StringRef macroName, |
36
|
|
|
|
|
|
|
SourceLineInfo const& lineInfo, |
37
|
|
|
|
|
|
|
StringRef capturedExpression, |
38
|
|
|
|
|
|
|
ResultDisposition::Flags resultDisposition ); |
39
|
50
|
|
|
|
|
|
~AssertionHandler() { |
40
|
50
|
50
|
|
|
|
|
if ( !m_completed ) { |
41
|
0
|
|
|
|
|
|
m_resultCapture.handleIncomplete( m_assertionInfo ); |
42
|
|
|
|
|
|
|
} |
43
|
50
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
template |
47
|
47
|
|
|
|
|
|
void handleExpr( ExprLhs const& expr ) { |
48
|
47
|
50
|
|
|
|
|
handleExpr( expr.makeUnaryExpr() ); |
49
|
47
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
void handleExpr( ITransientExpression const& expr ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
void handleMessage(ResultWas::OfType resultType, StringRef message); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
void handleExceptionThrownAsExpected(); |
55
|
|
|
|
|
|
|
void handleUnexpectedExceptionNotThrown(); |
56
|
|
|
|
|
|
|
void handleExceptionNotThrownAsExpected(); |
57
|
|
|
|
|
|
|
void handleThrowingCallSkipped(); |
58
|
|
|
|
|
|
|
void handleUnexpectedInflightException(); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
void complete(); |
61
|
|
|
|
|
|
|
void setCompleted(); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
// query |
64
|
|
|
|
|
|
|
auto allowThrows() const -> bool; |
65
|
|
|
|
|
|
|
}; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} // namespace Catch |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#endif // CATCH_ASSERTION_HANDLER_HPP_INCLUDED |