mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-17 02:25:38 +02:00
Eliminate some work when results won't be reported.
This commit is contained in:

committed by
Martin Hořeňovský

parent
8d380a7399
commit
a53ea30723
@@ -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
|
||||
|
Reference in New Issue
Block a user