mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Use StringRef on fatal error path
So far the fatal error path only uses string literals, so this removes an allocation from that context
This commit is contained in:
parent
4e85267203
commit
40209d1ae0
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "catch_stringref.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class AssertionResult;
|
class AssertionResult;
|
||||||
@ -43,7 +45,7 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual void exceptionEarlyReported() = 0;
|
virtual void exceptionEarlyReported() = 0;
|
||||||
|
|
||||||
virtual void handleFatalErrorCondition( std::string const& message ) = 0;
|
virtual void handleFatalErrorCondition( StringRef message ) = 0;
|
||||||
|
|
||||||
virtual bool lastAssertionPassed() = 0;
|
virtual bool lastAssertionPassed() = 0;
|
||||||
virtual void assertionPassed() = 0;
|
virtual void assertionPassed() = 0;
|
||||||
|
@ -208,7 +208,7 @@ namespace Catch {
|
|||||||
m_shouldReportUnexpected = false;
|
m_shouldReportUnexpected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::handleFatalErrorCondition(std::string const & message) {
|
void RunContext::handleFatalErrorCondition( StringRef message ) {
|
||||||
// First notify reporter that bad things happened
|
// First notify reporter that bad things happened
|
||||||
m_reporter->fatalErrorEncountered(message);
|
m_reporter->fatalErrorEncountered(message);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void exceptionEarlyReported() override;
|
void exceptionEarlyReported() override;
|
||||||
|
|
||||||
void handleFatalErrorCondition(std::string const& message) override;
|
void handleFatalErrorCondition( StringRef message ) override;
|
||||||
|
|
||||||
bool lastAssertionPassed() override;
|
bool lastAssertionPassed() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user