Eliminate some work when results won't be reported.

This commit is contained in:
Neal Coombes
2017-06-26 14:30:23 -05:00
committed by Martin Hořeňovský
parent 8d380a7399
commit a53ea30723
5 changed files with 57 additions and 17 deletions

View File

@@ -47,7 +47,7 @@ namespace Catch {
template<typename T>
ResultBuilder& operator << ( T const& value ) {
m_stream().oss << value;
stream().oss << value;
return *this;
}
@@ -81,6 +81,16 @@ namespace Catch {
AssertionInfo m_assertionInfo;
AssertionResultData m_data;
CopyableStream &stream()
{
if(!m_usedStream)
{
m_usedStream = true;
m_stream().oss.str("");
}
return m_stream();
}
static CopyableStream &m_stream()
{
static CopyableStream s;
@@ -90,6 +100,7 @@ namespace Catch {
bool m_shouldDebugBreak;
bool m_shouldThrow;
bool m_guardException;
bool m_usedStream;
};
} // namespace Catch