stc
Loading...
Searching...
No Matches
ConsoleReporter.hpp
Go to the documentation of this file.
1// Copyright Catch2 Authors
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE.txt or copy at
4// https://www.boost.org/LICENSE_1_0.txt)
5
6// SPDX-License-Identifier: BSL-1.0
7#ifndef CATCH_REPORTER_CONSOLE_HPP_INCLUDED
8#define CATCH_REPORTER_CONSOLE_HPP_INCLUDED
9
10#include <catch2/reporters/catch_reporter_streaming_base.hpp>
11#include <catch2/internal/catch_unique_ptr.hpp>
12
13namespace Catch::Vendored {
14 // Fwd decls
15 class ModTablePrinter;
16
17 class ModConsoleReporter : public StreamingReporterBase {
18 Detail::unique_ptr<ModTablePrinter> m_tablePrinter;
19
20 public:
21 ModConsoleReporter(ReporterConfig&& config);
23
24 virtual void noMatchingTestCases( StringRef unmatchedSpec ) override;
25 virtual void reportInvalidTestSpec( StringRef arg ) override;
26
27 virtual void assertionEnded(AssertionStats const& _assertionStats) override;
28
29 virtual void sectionStarting(SectionInfo const& _sectionInfo) override;
30 virtual void sectionEnded(SectionStats const& _sectionStats) override;
31
32 virtual void benchmarkPreparing( StringRef name ) override;
33 virtual void benchmarkStarting(BenchmarkInfo const& info) override;
34 virtual void benchmarkEnded(BenchmarkStats<> const& stats) override;
35 virtual void benchmarkFailed( StringRef error ) override;
36
37 virtual void testCaseEnded(TestCaseStats const& _testCaseStats) override;
38 virtual void testRunEnded(TestRunStats const& _testRunStats) override;
39 virtual void testRunStarting(TestRunInfo const& _testRunInfo) override;
40
41 private:
42 void lazyPrint();
43
44 void lazyPrintWithoutClosingBenchmarkTable();
45 void lazyPrintRunInfo();
46 void printTestCaseAndSectionHeader();
47
48 void printClosedHeader(std::string const& _name);
49 void printOpenHeader(std::string const& _name);
50
51 // if string has a : in first line will set indent to follow it on
52 // subsequent lines
53 void printHeaderString(std::string const& _string, std::size_t indent = 0);
54
55 void printTotalsDivider(Totals const& totals);
56
57 bool m_headerPrinted = false;
58 bool m_testRunInfoPrinted = false;
59 };
60
61} // end namespace Catch
62
63#endif // CATCH_REPORTER_CONSOLE_HPP_INCLUDED
Definition ConsoleReporter.hpp:17
virtual void reportInvalidTestSpec(StringRef arg) override
Definition ConsoleReporter.cpp:410
virtual void testRunStarting(TestRunInfo const &_testRunInfo) override
Definition ConsoleReporter.cpp:519
virtual void testCaseEnded(TestCaseStats const &_testCaseStats) override
Definition ConsoleReporter.cpp:508
virtual void benchmarkStarting(BenchmarkInfo const &info) override
Definition ConsoleReporter.cpp:475
virtual void benchmarkFailed(StringRef error) override
Definition ConsoleReporter.cpp:501
virtual void sectionStarting(SectionInfo const &_sectionInfo) override
Definition ConsoleReporter.cpp:431
virtual void benchmarkPreparing(StringRef name) override
Definition ConsoleReporter.cpp:458
virtual void sectionEnded(SectionStats const &_sectionStats) override
Definition ConsoleReporter.cpp:436
virtual void testRunEnded(TestRunStats const &_testRunStats) override
Definition ConsoleReporter.cpp:513
virtual void noMatchingTestCases(StringRef unmatchedSpec) override
Definition ConsoleReporter.cpp:406
virtual void benchmarkEnded(BenchmarkStats<> const &stats) override
Definition ConsoleReporter.cpp:484
virtual void assertionEnded(AssertionStats const &_assertionStats) override
Definition ConsoleReporter.cpp:414
Definition ConsoleReporter.cpp:39