Class RunContext

Synopsis

#include <include/internal/catch_run_context.h>

class RunContext : public IResultCapture, public IRunner

Description

No description yet.

Mentioned in

  • Other / Release Notes / Fixes

Inheritance

Ancestors: IRunner, IResultCapture

Methods

RunContext overload
~RunContext
aborting
acquireGeneratorTracker
assertionPassed
benchmarkEnded
benchmarkFailed
benchmarkPreparing
benchmarkStarting
config
emplaceUnscopedMessage
exceptionEarlyReported
getCurrentTestName
getLastResult
handleExpr
handleFatalErrorCondition
handleIncomplete
handleMessage
handleNonExpr
handleUnexpectedExceptionNotThrown
handleUnexpectedInflightException
lastAssertionPassed
operator=
popScopedMessage
pushScopedMessage
reporter
runTest
sectionEnded
sectionEndedEarly
sectionStarted
testGroupEnded
testGroupStarting

Source

Lines 34-152 in include/internal/catch_run_context.h.

class RunContext : public IResultCapture, public IRunner {
public:
    RunContext( RunContext const& ) = delete;
    RunContext& operator =( RunContext const& ) = delete;
    explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter );
    ~RunContext() override;
    void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );
    void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );
    Totals runTest(TestCase const& testCase);
    IConfigPtr config() const;
    IStreamingReporter& reporter() const;
public: // IResultCapture
    // Assertion handlers
    void handleExpr
            (   AssertionInfo const& info,
                ITransientExpression const& expr,
                AssertionReaction& reaction ) override;
    void handleMessage
            (   AssertionInfo const& info,
                ResultWas::OfType resultType,
                StringRef const& message,
                AssertionReaction& reaction ) override;
    void handleUnexpectedExceptionNotThrown
            (   AssertionInfo const& info,
                AssertionReaction& reaction ) override;
    void handleUnexpectedInflightException
            (   AssertionInfo const& info,
                std::string const& message,
                AssertionReaction& reaction ) override;
    void handleIncomplete
            (   AssertionInfo const& info ) override;
    void handleNonExpr
            (   AssertionInfo const &info,
                ResultWas::OfType resultType,
                AssertionReaction &reaction ) override;
    bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
    void sectionEnded( SectionEndInfo const& endInfo ) override;
    void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
    auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
    void benchmarkPreparing( std::string const& name ) override;
    void benchmarkStarting( BenchmarkInfo const& info ) override;
    void benchmarkEnded( BenchmarkStats<> const& stats ) override;
    void benchmarkFailed( std::string const& error ) override;
if // CATCH_CONFIG_ENABLE_BENCHMARKING
    void pushScopedMessage( MessageInfo const& message ) override;
    void popScopedMessage( MessageInfo const& message ) override;
    void emplaceUnscopedMessage( MessageBuilder const& builder ) override;
    std::string getCurrentTestName() const override;
    const AssertionResult* getLastResult() const override;
    void exceptionEarlyReported() override;
    void handleFatalErrorCondition( StringRef message ) override;
    bool lastAssertionPassed() override;
    void assertionPassed() override;
public:
    // !TBD We need to do this another way!
    bool aborting() const final;
private:
    void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr );
    void invokeActiveTestCase();
    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:
    void handleUnfinishedSections();
    TestRunInfo m_runInfo;
    IMutableContext& m_context;
    TestCase const* m_activeTestCase = nullptr;
    ITracker* m_testCaseTracker = nullptr;
    Option<AssertionResult> m_lastResult;
    IConfigPtr m_config;
    Totals m_totals;
    IStreamingReporterPtr m_reporter;
    std::vector<MessageInfo> m_messages;
    std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */
    AssertionInfo m_lastAssertionInfo;
    std::vector<SectionEndInfo> m_unfinishedSections;
    std::vector<ITracker*> m_activeSections;
    TrackerContext m_trackerContext;
    bool m_lastAssertionPassed = false;
    bool m_shouldReportUnexpected = true;
    bool m_includeSuccessfulResults;
};





Add Discussion as Guest

Log in