Split out LazyExpr into its own header
This enables us to avoid `catch_reporter_bases.hpp` being indirectly dependent on `catch_tostring.hpp`, cutting apart quite a bit indirect inclusions.
This commit is contained in:
parent
824ffe6525
commit
27f1756d8e
10 changed files with 72 additions and 45 deletions
30
src/catch2/internal/catch_lazy_expr.cpp
Normal file
30
src/catch2/internal/catch_lazy_expr.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <catch2/internal/catch_lazy_expr.hpp>
|
||||
|
||||
#include <catch2/internal/catch_decomposer.hpp>
|
||||
|
||||
|
||||
namespace Catch {
|
||||
|
||||
namespace {
|
||||
auto operator <<(std::ostream& os, ITransientExpression const& expr) -> std::ostream& {
|
||||
expr.streamReconstructedExpression(os);
|
||||
return os;
|
||||
}
|
||||
}
|
||||
|
||||
auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
|
||||
if (lazyExpr.m_isNegated)
|
||||
os << "!";
|
||||
|
||||
if (lazyExpr) {
|
||||
if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
|
||||
os << "(" << *lazyExpr.m_transientExpression << ")";
|
||||
else
|
||||
os << *lazyExpr.m_transientExpression;
|
||||
} else {
|
||||
os << "{** error - unchecked empty expression requested **}";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace Catch
|
Loading…
Add table
Add a link
Reference in a new issue