diff options
| author | Martin Hořeňovský | 2026-07-28 22:08:55 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-08-08 00:05:18 +0200 |
| commit | 4cde12851773b32fc5a0171f262e4281c8e28b01 (patch) | |
| tree | cdd11d3c9c86a2a6c9ba15fdfe69fd9555ecf850 /src | |
| parent | 0b4d7a5a1696dbdfb23fccad8c50db9dc9a417ea (diff) | |
| download | catch3-4cde12851773b32fc5a0171f262e4281c8e28b01.tar.gz | |
JSONReporter considers verbosity when listing tests
* Quiet verbosity provides just the test names
* Normal verbosity adds tags
* High verbosity add the source location of the tests
Listing tests with the quiet verbosity results in about 1/4 of the
previous output, which leads to measurably faster execution of
`catch_discover_tests` when it does not need tags for labels.
(If it does need tags, the output is about 1/2 of previous).
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/reporters/catch_reporter_json.cpp | 6 | ||||
| -rw-r--r-- | src/catch2/reporters/catch_reporter_json.hpp | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/catch2/reporters/catch_reporter_json.cpp b/src/catch2/reporters/catch_reporter_json.cpp index 6c093b40..39a2105d 100644 --- a/src/catch2/reporters/catch_reporter_json.cpp +++ b/src/catch2/reporters/catch_reporter_json.cpp @@ -349,13 +349,15 @@ namespace Catch { if (!info.className.empty()) { desc_writer.write( "class-name"_sr ).write( info.className ); } - { + if ( m_verbosity >= Verbosity::Normal ) { auto tag_writer = desc_writer.write( "tags"_sr ).writeArray(); for ( auto const& tag : info.tags ) { tag_writer.write( tag.original ); } } - writeSourceInfo( desc_writer, info.lineInfo ); + if ( m_verbosity >= Verbosity::High) { + writeSourceInfo( desc_writer, info.lineInfo ); + } } } void JsonReporter::listTags( std::vector<TagInfo> const& tags ) { diff --git a/src/catch2/reporters/catch_reporter_json.hpp b/src/catch2/reporters/catch_reporter_json.hpp index b28aaf8d..6de1bd77 100644 --- a/src/catch2/reporters/catch_reporter_json.hpp +++ b/src/catch2/reporters/catch_reporter_json.hpp @@ -85,9 +85,6 @@ namespace Catch { std::stack<Writer> m_writers{}; bool m_startedListing = false; - - // std::size_t m_sectionDepth = 0; - // std::size_t m_sectionStarted = 0; }; } // namespace Catch |