unittest-cpp/UnitTest++/RequiredCheckTestReporter.cpp
Austin Gilbert a9161c1ba6 This commit addresses two issues:
(1) unreachable code in for loop shenanigans is eliminated.
(2) code after a failing REQUIRE check no longer executes. Used a
    decorating TestReporter to achive this.
2016-02-06 09:29:38 -06:00

29 lines
No EOL
713 B
C++

#include "RequiredCheckTestReporter.h"
#include "CurrentTest.h"
#include "TestResults.h"
namespace UnitTest {
RequiredCheckTestReporter::RequiredCheckTestReporter(TestResults* results)
: m_results(results)
, m_throwingReporter(0)
, m_continue(0)
{
if(m_results)
{
m_throwingReporter.setDecorated(m_results->m_testReporter);
m_results->m_testReporter = &m_throwingReporter;
}
}
RequiredCheckTestReporter::~RequiredCheckTestReporter()
{
if(m_results) m_results->m_testReporter = m_throwingReporter.getDecorated();
}
bool RequiredCheckTestReporter::next()
{
return m_continue++ == 0;
}
}