MCPcopy Create free account
hub / github.com/catchorg/Catch2 / JsonReporter

Method JsonReporter

extras/catch_amalgamated.cpp:10661–10689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10659 } // namespace
10660
10661 JsonReporter::JsonReporter( ReporterConfig&& config ):
10662 StreamingReporterBase{ CATCH_MOVE( config ) } {
10663
10664 m_preferences.shouldRedirectStdOut = true;
10665 // TBD: Do we want to report all assertions? XML reporter does
10666 // not, but for machine-parseable reporters I think the answer
10667 // should be yes.
10668 m_preferences.shouldReportAllAssertions = true;
10669 // We only handle assertions when they end
10670 m_preferences.shouldReportAllAssertionStarts = false;
10671
10672 m_objectWriters.emplace( m_stream );
10673 m_writers.emplace( Writer::Object );
10674 auto& writer = m_objectWriters.top();
10675
10676 writer.write( "version"_sr ).write( 1 );
10677
10678 {
10679 auto metadata_writer = writer.write( "metadata"_sr ).writeObject();
10680 metadata_writer.write( "name"_sr ).write( m_config->name() );
10681 metadata_writer.write( "rng-seed"_sr ).write( m_config->rngSeed() );
10682 metadata_writer.write( "catch2-version"_sr )
10683 .write( libraryVersion() );
10684 if ( m_config->testSpec().hasFilters() ) {
10685 metadata_writer.write( "filters"_sr )
10686 .write( m_config->testSpec() );
10687 }
10688 }
10689 }
10690
10691 JsonReporter::~JsonReporter() {
10692 endListing();

Callers

nothing calls this directly

Calls 6

writeMethod · 0.45
writeObjectMethod · 0.45
nameMethod · 0.45
rngSeedMethod · 0.45
hasFiltersMethod · 0.45
testSpecMethod · 0.45

Tested by

no test coverage detected