mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Revirtualised IResultCapture methods
Didn't really impact runtime anyway, but will need to use interface for threading support.
This commit is contained in:
parent
51e281a684
commit
533cdc6bc1
@ -56,7 +56,7 @@ namespace Catch {
|
|||||||
StringRef capturedExpression,
|
StringRef capturedExpression,
|
||||||
ResultDisposition::Flags resultDisposition )
|
ResultDisposition::Flags resultDisposition )
|
||||||
: m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
|
: m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
|
||||||
m_resultCapture( static_cast<RunContext&>( getResultCapture() ) )
|
m_resultCapture( getResultCapture() )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AssertionHandler::~AssertionHandler() {
|
AssertionHandler::~AssertionHandler() {
|
||||||
|
@ -44,7 +44,7 @@ namespace Catch {
|
|||||||
AssertionInfo m_assertionInfo;
|
AssertionInfo m_assertionInfo;
|
||||||
AssertionReaction m_reaction;
|
AssertionReaction m_reaction;
|
||||||
bool m_completed = false;
|
bool m_completed = false;
|
||||||
RunContext& m_resultCapture;
|
IResultCapture& m_resultCapture;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AssertionHandler
|
AssertionHandler
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "catch_stringref.h"
|
#include "catch_stringref.h"
|
||||||
|
#include "catch_result_type.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
@ -22,6 +23,9 @@ namespace Catch {
|
|||||||
struct Counts;
|
struct Counts;
|
||||||
struct BenchmarkInfo;
|
struct BenchmarkInfo;
|
||||||
struct BenchmarkStats;
|
struct BenchmarkStats;
|
||||||
|
struct AssertionReaction;
|
||||||
|
|
||||||
|
struct ITransientExpression;
|
||||||
|
|
||||||
struct IResultCapture {
|
struct IResultCapture {
|
||||||
|
|
||||||
@ -40,6 +44,31 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual void handleFatalErrorCondition( StringRef message ) = 0;
|
virtual void handleFatalErrorCondition( StringRef message ) = 0;
|
||||||
|
|
||||||
|
virtual void handleExpr
|
||||||
|
( AssertionInfo const& info,
|
||||||
|
ITransientExpression const& expr,
|
||||||
|
AssertionReaction& reaction ) = 0;
|
||||||
|
virtual void handleMessage
|
||||||
|
( AssertionInfo const& info,
|
||||||
|
ResultWas::OfType resultType,
|
||||||
|
StringRef const& message,
|
||||||
|
AssertionReaction& reaction ) = 0;
|
||||||
|
virtual void handleUnexpectedExceptionNotThrown
|
||||||
|
( AssertionInfo const& info,
|
||||||
|
AssertionReaction& reaction ) = 0;
|
||||||
|
virtual void handleUnexpectedInflightException
|
||||||
|
( AssertionInfo const& info,
|
||||||
|
std::string const& message,
|
||||||
|
AssertionReaction& reaction ) = 0;
|
||||||
|
virtual void handleIncomplete
|
||||||
|
( AssertionInfo const& info ) = 0;
|
||||||
|
virtual void handleNonExpr
|
||||||
|
( AssertionInfo const &info,
|
||||||
|
ResultWas::OfType resultType,
|
||||||
|
AssertionReaction &reaction ) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool lastAssertionPassed() = 0;
|
virtual bool lastAssertionPassed() = 0;
|
||||||
virtual void assertionPassed() = 0;
|
virtual void assertionPassed() = 0;
|
||||||
|
|
||||||
|
@ -75,44 +75,33 @@ namespace Catch {
|
|||||||
IConfigPtr config() const;
|
IConfigPtr config() const;
|
||||||
IStreamingReporter& reporter() const;
|
IStreamingReporter& reporter() const;
|
||||||
|
|
||||||
|
public: // IResultCapture
|
||||||
|
|
||||||
// Assertion handlers
|
// Assertion handlers
|
||||||
void handleExpr
|
void handleExpr
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
ITransientExpression const& expr,
|
ITransientExpression const& expr,
|
||||||
AssertionReaction& reaction );
|
AssertionReaction& reaction ) override;
|
||||||
void handleMessage
|
void handleMessage
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
ResultWas::OfType resultType,
|
ResultWas::OfType resultType,
|
||||||
StringRef const& message,
|
StringRef const& message,
|
||||||
AssertionReaction& reaction );
|
AssertionReaction& reaction ) override;
|
||||||
void handleUnexpectedExceptionNotThrown
|
void handleUnexpectedExceptionNotThrown
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
AssertionReaction& reaction );
|
AssertionReaction& reaction ) override;
|
||||||
void handleUnexpectedInflightException
|
void handleUnexpectedInflightException
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
std::string const& message,
|
std::string const& message,
|
||||||
AssertionReaction& reaction );
|
AssertionReaction& reaction ) override;
|
||||||
void handleIncomplete
|
void handleIncomplete
|
||||||
( AssertionInfo const& info );
|
( AssertionInfo const& info ) override;
|
||||||
void handleNonExpr
|
void handleNonExpr
|
||||||
( AssertionInfo const &info,
|
( AssertionInfo const &info,
|
||||||
ResultWas::OfType resultType,
|
ResultWas::OfType resultType,
|
||||||
AssertionReaction &reaction );
|
AssertionReaction &reaction ) override;
|
||||||
|
|
||||||
void reportExpr
|
|
||||||
(AssertionInfo const &info,
|
|
||||||
ResultWas::OfType resultType,
|
|
||||||
ITransientExpression const *expr,
|
|
||||||
bool negated );
|
|
||||||
|
|
||||||
void populateReaction( AssertionReaction& reaction );
|
|
||||||
|
|
||||||
public: // IResultCapture
|
|
||||||
|
|
||||||
void assertionEnded(AssertionResult const& result);
|
|
||||||
|
|
||||||
bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
|
bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
|
||||||
bool testForMissingAssertions(Counts& assertions);
|
|
||||||
|
|
||||||
void sectionEnded( SectionEndInfo const& endInfo ) override;
|
void sectionEnded( SectionEndInfo const& endInfo ) override;
|
||||||
void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
|
void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
|
||||||
@ -145,6 +134,16 @@ namespace Catch {
|
|||||||
void invokeActiveTestCase();
|
void invokeActiveTestCase();
|
||||||
|
|
||||||
void resetAssertionInfo();
|
void resetAssertionInfo();
|
||||||
|
bool testForMissingAssertions( Counts& assertions );
|
||||||
|
|
||||||
|
void assertionEnded( AssertionResult const& result );
|
||||||
|
void reportExpr
|
||||||
|
( AssertionInfo const &info,
|
||||||
|
ResultWas::OfType resultType,
|
||||||
|
ITransientExpression const *expr,
|
||||||
|
bool negated );
|
||||||
|
|
||||||
|
void populateReaction( AssertionReaction& reaction );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user