Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/catch2/catch_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ namespace Catch {
int Config::abortAfter() const { return m_data.abortAfter; }
bool Config::showInvisibles() const { return m_data.showInvisibles; }
Verbosity Config::verbosity() const { return m_data.verbosity; }
bool Config::outputTestCaseNameFirst() const { return m_data.outputTestCaseNameFirst; }
bool Config::outputTestCaseStats() const { return m_data.outputTestCaseStats; }

bool Config::skipBenchmarks() const { return m_data.skipBenchmarks; }
bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; }
Expand Down
4 changes: 4 additions & 0 deletions src/catch2/catch_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ namespace Catch {
bool filenamesAsTags = false;
bool libIdentify = false;
bool allowZeroTests = false;
bool outputTestCaseNameFirst = false;
bool outputTestCaseStats = false;

int abortAfter = -1;
uint32_t rngSeed = generateRandomSeed(GenerateFrom::Default);
Expand Down Expand Up @@ -132,6 +134,8 @@ namespace Catch {
int abortAfter() const override;
bool showInvisibles() const override;
Verbosity verbosity() const override;
bool outputTestCaseNameFirst() const override;
bool outputTestCaseStats() const override;
bool skipBenchmarks() const override;
bool benchmarkNoAnalysis() const override;
unsigned int benchmarkSamples() const override;
Expand Down
2 changes: 2 additions & 0 deletions src/catch2/interfaces/catch_interfaces_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ namespace Catch {
virtual ColourMode defaultColourMode() const = 0;
virtual std::vector<std::string> const& getSectionsToRun() const = 0;
virtual Verbosity verbosity() const = 0;
virtual bool outputTestCaseNameFirst() const = 0;
virtual bool outputTestCaseStats() const = 0;

virtual bool skipBenchmarks() const = 0;
virtual bool benchmarkNoAnalysis() const = 0;
Expand Down
6 changes: 6 additions & 0 deletions src/catch2/internal/catch_commandline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ namespace Catch {
| Opt( setVerbosity, "quiet|normal|high" )
["-v"]["--verbosity"]
( "set output verbosity" )
| Opt( config.outputTestCaseNameFirst)
["--output-test-case-name-first"]
( "test case name will be printed before the test is run" )
| Opt( config.outputTestCaseStats)
["--output-test-case-stats"]
( "prints assertion stat data of the test case run" )
| Opt( config.listTests )
["--list-tests"]
( "list all/matching test cases" )
Expand Down
20 changes: 20 additions & 0 deletions src/catch2/reporters/catch_reporter_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,31 @@ void ConsoleReporter::benchmarkFailed( StringRef error ) {
<< ColumnBreak() << RowBreak();
}

void ConsoleReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
StreamingReporterBase::testCaseStarting( testInfo );

if ( m_config->outputTestCaseNameFirst() ) {
m_stream << testInfo.name << ":\n";
}
}

void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {
m_tablePrinter->close();
StreamingReporterBase::testCaseEnded(_testCaseStats);
m_headerPrinted = false;

if ( !_testCaseStats.aborting && m_config->outputTestCaseStats() ) {
if (!m_config->outputTestCaseNameFirst())
{
m_stream << _testCaseStats.testInfo->name << ": ";
}

m_stream << _testCaseStats.totals.assertions.passed << " passed "
<< _testCaseStats.totals.assertions.failed << " failed "
<< _testCaseStats.totals.assertions.skipped << " skipped\n";
}
}

void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
printTotalsDivider(_testRunStats.totals);
printTestRunTotals( m_stream, *m_colour, _testRunStats.totals );
Expand Down
1 change: 1 addition & 0 deletions src/catch2/reporters/catch_reporter_console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace Catch {
void benchmarkEnded(BenchmarkStats<> const& stats) override;
void benchmarkFailed( StringRef error ) override;

void testCaseStarting( TestCaseInfo const& testInfo ) override;
void testCaseEnded(TestCaseStats const& _testCaseStats) override;
void testRunEnded(TestRunStats const& _testRunStats) override;
void testRunStarting(TestRunInfo const& _testRunInfo) override;
Expand Down