2020-08-30 15:43:45 +02:00
|
|
|
|
|
|
|
|
// Copyright Catch2 Authors
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
2022-10-28 11:22:53 +02:00
|
|
|
// (See accompanying file LICENSE.txt or copy at
|
2020-08-30 15:43:45 +02:00
|
|
|
// https://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
|
|
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
2020-03-30 10:34:21 +02:00
|
|
|
#include <catch2/interfaces/catch_interfaces_reporter.hpp>
|
2020-08-01 19:09:18 +02:00
|
|
|
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
2020-03-30 10:34:21 +02:00
|
|
|
#include <catch2/internal/catch_console_colour.hpp>
|
2020-08-01 20:32:26 +02:00
|
|
|
#include <catch2/internal/catch_console_width.hpp>
|
2020-05-10 16:44:27 +02:00
|
|
|
#include <catch2/catch_message.hpp>
|
2020-03-30 10:34:21 +02:00
|
|
|
#include <catch2/internal/catch_list.hpp>
|
|
|
|
|
#include <catch2/internal/catch_string_manip.hpp>
|
2020-07-29 14:30:19 +02:00
|
|
|
#include <catch2/catch_test_case_info.hpp>
|
2021-01-25 12:22:54 +01:00
|
|
|
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
2022-04-04 21:07:04 +02:00
|
|
|
#include <catch2/internal/catch_move_and_forward.hpp>
|
2022-04-16 14:43:40 +02:00
|
|
|
#include <catch2/internal/catch_istream.hpp>
|
2019-06-21 23:15:08 +02:00
|
|
|
|
|
|
|
|
#include <algorithm>
|
2022-04-12 21:22:43 +02:00
|
|
|
#include <cassert>
|
2019-06-21 23:15:08 +02:00
|
|
|
#include <iomanip>
|
2017-07-19 10:13:47 +02:00
|
|
|
|
|
|
|
|
namespace Catch {
|
|
|
|
|
|
2022-04-04 21:07:04 +02:00
|
|
|
ReporterConfig::ReporterConfig(
|
|
|
|
|
IConfig const* _fullConfig,
|
2022-04-12 21:22:43 +02:00
|
|
|
Detail::unique_ptr<IStream> _stream,
|
2022-04-04 21:07:04 +02:00
|
|
|
ColourMode colourMode,
|
|
|
|
|
std::map<std::string, std::string> customOptions ):
|
2022-04-12 21:22:43 +02:00
|
|
|
m_stream( CATCH_MOVE(_stream) ),
|
2022-04-04 21:07:04 +02:00
|
|
|
m_fullConfig( _fullConfig ),
|
|
|
|
|
m_colourMode( colourMode ),
|
|
|
|
|
m_customOptions( CATCH_MOVE( customOptions ) ) {}
|
2017-07-19 10:13:47 +02:00
|
|
|
|
2022-04-12 21:22:43 +02:00
|
|
|
Detail::unique_ptr<IStream> ReporterConfig::takeStream() && {
|
|
|
|
|
assert( m_stream );
|
|
|
|
|
return CATCH_MOVE( m_stream );
|
|
|
|
|
}
|
2020-01-25 15:32:56 +01:00
|
|
|
IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }
|
2022-04-04 21:07:04 +02:00
|
|
|
ColourMode ReporterConfig::colourMode() const { return m_colourMode; }
|
|
|
|
|
|
|
|
|
|
std::map<std::string, std::string> const&
|
|
|
|
|
ReporterConfig::customOptions() const {
|
|
|
|
|
return m_customOptions;
|
|
|
|
|
}
|
2017-07-19 10:13:47 +02:00
|
|
|
|
2022-04-16 14:43:40 +02:00
|
|
|
ReporterConfig::~ReporterConfig() = default;
|
|
|
|
|
|
2021-09-06 22:59:40 +02:00
|
|
|
AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
|
|
|
|
|
std::vector<MessageInfo> const& _infoMessages,
|
|
|
|
|
Totals const& _totals )
|
2017-07-19 10:13:47 +02:00
|
|
|
: assertionResult( _assertionResult ),
|
|
|
|
|
infoMessages( _infoMessages ),
|
|
|
|
|
totals( _totals )
|
|
|
|
|
{
|
2017-08-08 17:53:01 +01:00
|
|
|
assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;
|
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
if( assertionResult.hasMessage() ) {
|
|
|
|
|
// Copy message into messages list.
|
|
|
|
|
// !TBD This should have been done earlier, somewhere
|
2017-08-14 08:54:57 +01:00
|
|
|
MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
|
2017-07-19 10:13:47 +02:00
|
|
|
builder << assertionResult.getMessage();
|
|
|
|
|
builder.m_info.message = builder.m_stream.str();
|
|
|
|
|
|
|
|
|
|
infoMessages.push_back( builder.m_info );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-28 13:00:24 +01:00
|
|
|
SectionStats::SectionStats( SectionInfo&& _sectionInfo,
|
2017-07-19 10:13:47 +02:00
|
|
|
Counts const& _assertions,
|
|
|
|
|
double _durationInSeconds,
|
|
|
|
|
bool _missingAssertions )
|
2023-01-28 13:00:24 +01:00
|
|
|
: sectionInfo( CATCH_MOVE(_sectionInfo) ),
|
2017-07-19 10:13:47 +02:00
|
|
|
assertions( _assertions ),
|
|
|
|
|
durationInSeconds( _durationInSeconds ),
|
|
|
|
|
missingAssertions( _missingAssertions )
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
|
|
|
|
|
Totals const& _totals,
|
|
|
|
|
std::string const& _stdOut,
|
|
|
|
|
std::string const& _stdErr,
|
|
|
|
|
bool _aborting )
|
2019-11-04 21:35:57 +01:00
|
|
|
: testInfo( &_testInfo ),
|
2017-07-19 10:13:47 +02:00
|
|
|
totals( _totals ),
|
|
|
|
|
stdOut( _stdOut ),
|
|
|
|
|
stdErr( _stdErr ),
|
|
|
|
|
aborting( _aborting )
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
|
|
|
|
|
Totals const& _totals,
|
|
|
|
|
bool _aborting )
|
|
|
|
|
: runInfo( _runInfo ),
|
|
|
|
|
totals( _totals ),
|
|
|
|
|
aborting( _aborting )
|
|
|
|
|
{}
|
|
|
|
|
|
2022-03-06 15:37:16 +01:00
|
|
|
IEventListener::~IEventListener() = default;
|
2017-07-19 10:13:47 +02:00
|
|
|
|
|
|
|
|
} // end namespace Catch
|