mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Small defensive tweak on checking expression
This commit is contained in:
parent
e401601ac1
commit
01234172a9
@ -44,7 +44,7 @@ namespace Catch
|
|||||||
m_filename( filename ),
|
m_filename( filename ),
|
||||||
m_line( line ),
|
m_line( line ),
|
||||||
m_expr( expr ),
|
m_expr( expr ),
|
||||||
m_op( m_expr[0] == '!' ? "!" : "" ),
|
m_op( isNotExpression( expr ) ? "!" : "" ),
|
||||||
m_result( result ),
|
m_result( result ),
|
||||||
m_isNot( isNot ),
|
m_isNot( isNot ),
|
||||||
m_expressionIncomplete( false )
|
m_expressionIncomplete( false )
|
||||||
@ -153,6 +153,15 @@ namespace Catch
|
|||||||
return "{can't expand - use " + m_macroName + "_NOT( " + m_expr.substr(1) + " ) instead of " + m_macroName + "( " + m_expr + " ) for better diagnostics}";
|
return "{can't expand - use " + m_macroName + "_NOT( " + m_expr.substr(1) + " ) instead of " + m_macroName + "( " + m_expr + " ) for better diagnostics}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
bool isNotExpression
|
||||||
|
(
|
||||||
|
const char* expr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return expr && expr[0] == '!';
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_macroName;
|
std::string m_macroName;
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
|
Loading…
Reference in New Issue
Block a user