Fix Listening reporter use of ReporterPreferences

This commit is contained in:
Martin Hořeňovský 2018-07-22 22:57:34 +02:00
parent 797d3b04df
commit 12a8dfa2f2
2 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,11 @@
namespace Catch {
ListeningReporter::ListeningReporter() {
// We will assume that listeners will always want all assertions
m_preferences.shouldReportAllAssertions = true;
}
void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) {
m_listeners.push_back( std::move( listener ) );
}
@ -18,10 +23,11 @@ namespace Catch {
void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) {
assert(!m_reporter && "Listening reporter can wrap only 1 real reporter");
m_reporter = std::move( reporter );
m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut;
}
ReporterPreferences ListeningReporter::getPreferences() const {
return m_reporter->getPreferences();
return m_preferences;
}
std::set<Verbosity> ListeningReporter::getSupportedVerbosities() {

View File

@ -15,8 +15,11 @@ namespace Catch {
using Reporters = std::vector<IStreamingReporterPtr>;
Reporters m_listeners;
IStreamingReporterPtr m_reporter = nullptr;
ReporterPreferences m_preferences;
public:
ListeningReporter();
void addListener( IStreamingReporterPtr&& listener );
void addReporter( IStreamingReporterPtr&& reporter );