diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp index f6bb2cfb..6819cd63 100644 --- a/include/internal/catch_assertionresult.cpp +++ b/include/internal/catch_assertionresult.cpp @@ -14,7 +14,7 @@ namespace Catch { bool DecomposedExpression::isBinaryExpression() const { return false; } - + void AssertionResultData::negate( bool parenthesize ) { negated = !negated; parenthesized = parenthesize; @@ -68,16 +68,16 @@ namespace Catch { std::string AssertionResult::getExpression() const { if (isFalseTest(m_info.resultDisposition)) - return '!' + std::string(m_info.capturedExpression); + return '!' + std::string(m_info.capturedExpression.c_str()); else - return std::string(m_info.capturedExpression); + return std::string(m_info.capturedExpression.c_str()); } std::string AssertionResult::getExpressionInMacro() const { if( m_info.macroName[0] == 0 ) - return std::string(m_info.capturedExpression); + return std::string(m_info.capturedExpression.c_str()); else - return std::string(m_info.macroName) + "( " + m_info.capturedExpression + " )"; + return std::string(m_info.macroName.c_str()) + "( " + m_info.capturedExpression.c_str() + " )"; } bool AssertionResult::hasExpandedExpression() const { @@ -96,7 +96,7 @@ namespace Catch { } std::string AssertionResult::getTestMacroName() const { - return m_info.macroName; + return m_info.macroName.c_str(); } void AssertionResult::discardDecomposedExpression() const { diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h index 8c0d198a..7e67faaa 100644 --- a/include/internal/catch_assertionresult.h +++ b/include/internal/catch_assertionresult.h @@ -11,6 +11,7 @@ #include #include "catch_result_type.h" #include "catch_common.h" +#include "catch_stringref.h" namespace Catch { @@ -39,9 +40,9 @@ namespace Catch { struct AssertionInfo { - char const * macroName; + StringRef macroName; SourceLineInfo lineInfo; - char const * capturedExpression; + StringRef capturedExpression; ResultDisposition::Flags resultDisposition; AssertionInfo() = delete; diff --git a/include/internal/catch_interfaces_reporter.cpp b/include/internal/catch_interfaces_reporter.cpp index 8ad16248..2f820bf8 100644 --- a/include/internal/catch_interfaces_reporter.cpp +++ b/include/internal/catch_interfaces_reporter.cpp @@ -40,7 +40,7 @@ namespace Catch { if( assertionResult.hasMessage() ) { // Copy message into messages list. // !TBD This should have been done earlier, somewhere - MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); + MessageBuilder builder( assertionResult.getTestMacroName().c_str(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); builder << assertionResult.getMessage(); builder.m_info.message = builder.m_stream.str(); diff --git a/include/internal/catch_result_builder.cpp b/include/internal/catch_result_builder.cpp index c154010a..a908c359 100644 --- a/include/internal/catch_result_builder.cpp +++ b/include/internal/catch_result_builder.cpp @@ -30,9 +30,9 @@ namespace Catch { } - ResultBuilder::ResultBuilder( char const* macroName, + ResultBuilder::ResultBuilder( StringRef macroName, SourceLineInfo const& lineInfo, - char const* capturedExpression, + StringRef capturedExpression, ResultDisposition::Flags resultDisposition ) : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition } { @@ -99,7 +99,7 @@ namespace Catch { assert( !isFalseTest( m_assertionInfo.resultDisposition ) ); AssertionResultData data = m_data; data.resultType = ResultWas::Ok; - data.reconstructedExpression = m_assertionInfo.capturedExpression; + data.reconstructedExpression = m_assertionInfo.capturedExpression.c_str(); std::string actualMessage = Catch::translateActiveException(); if( !matcher.match( actualMessage ) ) { @@ -166,7 +166,7 @@ namespace Catch { } void ResultBuilder::reconstructExpression( std::string& dest ) const { - dest = m_assertionInfo.capturedExpression; + dest = m_assertionInfo.capturedExpression.c_str(); } void ResultBuilder::setExceptionGuard() { diff --git a/include/internal/catch_result_builder.h b/include/internal/catch_result_builder.h index 6639b541..1ccdd9c0 100644 --- a/include/internal/catch_result_builder.h +++ b/include/internal/catch_result_builder.h @@ -31,9 +31,9 @@ namespace Catch { class ResultBuilder : public DecomposedExpression { public: - ResultBuilder( char const* macroName, + ResultBuilder( StringRef macroName, SourceLineInfo const& lineInfo, - char const* capturedExpression, + StringRef capturedExpression, ResultDisposition::Flags resultDisposition); ~ResultBuilder();