Stop recounting constant string's length on each passed assertion

This commit is contained in:
Martin Hořeňovský 2017-11-13 12:27:02 +01:00
parent e484236825
commit d09fe4459d

View File

@ -8,6 +8,8 @@
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
static auto const& defaultExpression = "{Unknown expression after the reported line}";
namespace Catch { namespace Catch {
StreamRedirect::StreamRedirect(std::ostream& stream, std::string& targetString) StreamRedirect::StreamRedirect(std::ostream& stream, std::string& targetString)
@ -253,8 +255,8 @@ namespace Catch {
void RunContext::assertionPassed() { void RunContext::assertionPassed() {
++m_totals.assertions.passed; ++m_totals.assertions.passed;
m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"; m_lastAssertionInfo.capturedExpression = StringRef(defaultExpression, sizeof(defaultExpression) - 1);
m_lastAssertionInfo.macroName = ""; m_lastAssertionInfo.macroName = StringRef("", 0);
} }
void RunContext::assertionRun() { void RunContext::assertionRun() {