mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-27 00:28:49 +03:00
(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.
29 lines
No EOL
713 B
C++
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;
|
|
}
|
|
} |