mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-23 05:46:11 +01:00
Merge pull request #1983 from s7726/patch-1
Update catch_reporter_tap.hpp
This commit is contained in:
commit
40937b67c7
@ -23,16 +23,17 @@ namespace Catch {
|
|||||||
|
|
||||||
using StreamingReporterBase::StreamingReporterBase;
|
using StreamingReporterBase::StreamingReporterBase;
|
||||||
|
|
||||||
|
TAPReporter( ReporterConfig const& config )
|
||||||
|
: StreamingReporterBase( config ) {
|
||||||
|
m_reporterPrefs.shouldReportAllAssertions = true;
|
||||||
|
}
|
||||||
|
|
||||||
~TAPReporter() override;
|
~TAPReporter() override;
|
||||||
|
|
||||||
static std::string getDescription() {
|
static std::string getDescription() {
|
||||||
return "Reports test results in TAP format, suitable for test harnesses";
|
return "Reports test results in TAP format, suitable for test harnesses";
|
||||||
}
|
}
|
||||||
|
|
||||||
ReporterPreferences getPreferences() const override {
|
|
||||||
return m_reporterPrefs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void noMatchingTestCases( std::string const& spec ) override {
|
void noMatchingTestCases( std::string const& spec ) override {
|
||||||
stream << "# No test cases matched '" << spec << "'" << std::endl;
|
stream << "# No test cases matched '" << spec << "'" << std::endl;
|
||||||
}
|
}
|
||||||
@ -203,16 +204,15 @@ namespace Catch {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// using messages.end() directly (or auto) yields compilation error:
|
const auto itEnd = messages.cend();
|
||||||
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
const auto N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
||||||
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Colour colourGuard( colour );
|
Colour colourGuard( colour );
|
||||||
stream << " with " << pluralise( N, "message" ) << ":";
|
stream << " with " << pluralise( N, "message" ) << ":";
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; itMessage != itEnd; ) {
|
while( itMessage != itEnd ) {
|
||||||
// If this assertion is a warning ignore any INFO messages
|
// If this assertion is a warning ignore any INFO messages
|
||||||
if( printInfoMessages || itMessage->type != ResultWas::Info ) {
|
if( printInfoMessages || itMessage->type != ResultWas::Info ) {
|
||||||
stream << " '" << itMessage->message << "'";
|
stream << " '" << itMessage->message << "'";
|
||||||
@ -220,7 +220,9 @@ namespace Catch {
|
|||||||
Colour colourGuard( dimColour() );
|
Colour colourGuard( dimColour() );
|
||||||
stream << " and";
|
stream << " and";
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
++itMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,10 +236,9 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void printTotals( const Totals& totals ) const {
|
void printTotals( const Totals& totals ) const {
|
||||||
|
stream << "1.." << totals.assertions.total();
|
||||||
if( totals.testCases.total() == 0 ) {
|
if( totals.testCases.total() == 0 ) {
|
||||||
stream << "1..0 # Skipped: No tests ran.";
|
stream << " # Skipped: No tests ran.";
|
||||||
} else {
|
|
||||||
stream << "1.." << counter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user