mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Use StringRef as the argument to benchmark{Failed,Preparing}
This commit is contained in:
parent
5741de9ccd
commit
c9371865d4
@ -44,10 +44,10 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
||||||
|
|
||||||
virtual void benchmarkPreparing( std::string const& name ) = 0;
|
virtual void benchmarkPreparing( StringRef name ) = 0;
|
||||||
virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
|
virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
|
||||||
virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;
|
virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;
|
||||||
virtual void benchmarkFailed( std::string const& error ) = 0;
|
virtual void benchmarkFailed( StringRef error ) = 0;
|
||||||
|
|
||||||
virtual void pushScopedMessage( MessageInfo const& message ) = 0;
|
virtual void pushScopedMessage( MessageInfo const& message ) = 0;
|
||||||
virtual void popScopedMessage( MessageInfo const& message ) = 0;
|
virtual void popScopedMessage( MessageInfo const& message ) = 0;
|
||||||
|
@ -201,10 +201,10 @@ namespace Catch {
|
|||||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
|
virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
|
||||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
||||||
|
|
||||||
virtual void benchmarkPreparing( std::string const& ) {}
|
virtual void benchmarkPreparing( StringRef ) {}
|
||||||
virtual void benchmarkStarting( BenchmarkInfo const& ) {}
|
virtual void benchmarkStarting( BenchmarkInfo const& ) {}
|
||||||
virtual void benchmarkEnded( BenchmarkStats<> const& ) {}
|
virtual void benchmarkEnded( BenchmarkStats<> const& ) {}
|
||||||
virtual void benchmarkFailed( std::string const& ) {}
|
virtual void benchmarkFailed( StringRef ) {}
|
||||||
|
|
||||||
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
|
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ namespace Catch {
|
|||||||
m_unfinishedSections.push_back(endInfo);
|
m_unfinishedSections.push_back(endInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::benchmarkPreparing(std::string const& name) {
|
void RunContext::benchmarkPreparing( StringRef name ) {
|
||||||
m_reporter->benchmarkPreparing(name);
|
m_reporter->benchmarkPreparing(name);
|
||||||
}
|
}
|
||||||
void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
|
void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
|
||||||
@ -325,7 +325,7 @@ namespace Catch {
|
|||||||
void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {
|
void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {
|
||||||
m_reporter->benchmarkEnded( stats );
|
m_reporter->benchmarkEnded( stats );
|
||||||
}
|
}
|
||||||
void RunContext::benchmarkFailed(std::string const & error) {
|
void RunContext::benchmarkFailed( StringRef error ) {
|
||||||
m_reporter->benchmarkFailed( error );
|
m_reporter->benchmarkFailed( error );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,10 @@ namespace Catch {
|
|||||||
|
|
||||||
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
||||||
|
|
||||||
void benchmarkPreparing( std::string const& name ) override;
|
void benchmarkPreparing( StringRef name ) override;
|
||||||
void benchmarkStarting( BenchmarkInfo const& info ) override;
|
void benchmarkStarting( BenchmarkInfo const& info ) override;
|
||||||
void benchmarkEnded( BenchmarkStats<> const& stats ) override;
|
void benchmarkEnded( BenchmarkStats<> const& stats ) override;
|
||||||
void benchmarkFailed( std::string const& error ) override;
|
void benchmarkFailed( StringRef error ) override;
|
||||||
|
|
||||||
void pushScopedMessage( MessageInfo const& message ) override;
|
void pushScopedMessage( MessageInfo const& message ) override;
|
||||||
void popScopedMessage( MessageInfo const& message ) override;
|
void popScopedMessage( MessageInfo const& message ) override;
|
||||||
|
@ -434,10 +434,12 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
|
|||||||
StreamingReporterBase::sectionEnded(_sectionStats);
|
StreamingReporterBase::sectionEnded(_sectionStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleReporter::benchmarkPreparing(std::string const& name) {
|
void ConsoleReporter::benchmarkPreparing( StringRef name ) {
|
||||||
lazyPrintWithoutClosingBenchmarkTable();
|
lazyPrintWithoutClosingBenchmarkTable();
|
||||||
|
|
||||||
auto nameCol = TextFlow::Column(name).width(static_cast<std::size_t>(m_tablePrinter->columnInfos()[0].width - 2));
|
auto nameCol = TextFlow::Column( static_cast<std::string>( name ) )
|
||||||
|
.width( static_cast<std::size_t>(
|
||||||
|
m_tablePrinter->columnInfos()[0].width - 2 ) );
|
||||||
|
|
||||||
bool firstLine = true;
|
bool firstLine = true;
|
||||||
for (auto line : nameCol) {
|
for (auto line : nameCol) {
|
||||||
@ -473,7 +475,7 @@ void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleReporter::benchmarkFailed(std::string const& error) {
|
void ConsoleReporter::benchmarkFailed( StringRef error ) {
|
||||||
Colour colour(Colour::Red);
|
Colour colour(Colour::Red);
|
||||||
(*m_tablePrinter)
|
(*m_tablePrinter)
|
||||||
<< "Benchmark failed (" << error << ')'
|
<< "Benchmark failed (" << error << ')'
|
||||||
|
@ -42,10 +42,10 @@ namespace Catch {
|
|||||||
void sectionStarting(SectionInfo const& _sectionInfo) override;
|
void sectionStarting(SectionInfo const& _sectionInfo) override;
|
||||||
void sectionEnded(SectionStats const& _sectionStats) override;
|
void sectionEnded(SectionStats const& _sectionStats) override;
|
||||||
|
|
||||||
void benchmarkPreparing(std::string const& name) override;
|
void benchmarkPreparing( StringRef name ) override;
|
||||||
void benchmarkStarting(BenchmarkInfo const& info) override;
|
void benchmarkStarting(BenchmarkInfo const& info) override;
|
||||||
void benchmarkEnded(BenchmarkStats<> const& stats) override;
|
void benchmarkEnded(BenchmarkStats<> const& stats) override;
|
||||||
void benchmarkFailed(std::string const& error) override;
|
void benchmarkFailed( StringRef error ) override;
|
||||||
|
|
||||||
void testCaseEnded(TestCaseStats const& _testCaseStats) override;
|
void testCaseEnded(TestCaseStats const& _testCaseStats) override;
|
||||||
void testGroupEnded(TestGroupStats const& _testGroupStats) override;
|
void testGroupEnded(TestGroupStats const& _testGroupStats) override;
|
||||||
|
@ -35,7 +35,7 @@ namespace Catch {
|
|||||||
m_reporter->reportInvalidArguments( arg );
|
m_reporter->reportInvalidArguments( arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListeningReporter::benchmarkPreparing( std::string const& name ) {
|
void ListeningReporter::benchmarkPreparing( StringRef name ) {
|
||||||
for (auto& listener : m_listeners) {
|
for (auto& listener : m_listeners) {
|
||||||
listener->benchmarkPreparing(name);
|
listener->benchmarkPreparing(name);
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ namespace Catch {
|
|||||||
m_reporter->benchmarkEnded( benchmarkStats );
|
m_reporter->benchmarkEnded( benchmarkStats );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListeningReporter::benchmarkFailed( std::string const& error ) {
|
void ListeningReporter::benchmarkFailed( StringRef error ) {
|
||||||
for (auto& listener : m_listeners) {
|
for (auto& listener : m_listeners) {
|
||||||
listener->benchmarkFailed(error);
|
listener->benchmarkFailed(error);
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ namespace Catch {
|
|||||||
|
|
||||||
void reportInvalidArguments(std::string const&arg) override;
|
void reportInvalidArguments(std::string const&arg) override;
|
||||||
|
|
||||||
void benchmarkPreparing(std::string const& name) override;
|
void benchmarkPreparing( StringRef name ) override;
|
||||||
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
|
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
|
||||||
void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
|
void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
|
||||||
void benchmarkFailed(std::string const&) override;
|
void benchmarkFailed( StringRef error ) override;
|
||||||
|
|
||||||
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
||||||
void testGroupStarting( GroupInfo const& groupInfo ) override;
|
void testGroupStarting( GroupInfo const& groupInfo ) override;
|
||||||
|
@ -229,7 +229,7 @@ namespace Catch {
|
|||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmlReporter::benchmarkPreparing(std::string const& name) {
|
void XmlReporter::benchmarkPreparing( StringRef name ) {
|
||||||
m_xml.startElement("BenchmarkResults")
|
m_xml.startElement("BenchmarkResults")
|
||||||
.writeAttribute("name"_sr, name);
|
.writeAttribute("name"_sr, name);
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ namespace Catch {
|
|||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmlReporter::benchmarkFailed(std::string const &error) {
|
void XmlReporter::benchmarkFailed(StringRef error) {
|
||||||
m_xml.scopedElement("failed").
|
m_xml.scopedElement("failed").
|
||||||
writeAttribute("message"_sr, error);
|
writeAttribute("message"_sr, error);
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
|
@ -51,10 +51,10 @@ namespace Catch {
|
|||||||
|
|
||||||
void testRunEnded(TestRunStats const& testRunStats) override;
|
void testRunEnded(TestRunStats const& testRunStats) override;
|
||||||
|
|
||||||
void benchmarkPreparing(std::string const& name) override;
|
void benchmarkPreparing( StringRef name ) override;
|
||||||
void benchmarkStarting(BenchmarkInfo const&) override;
|
void benchmarkStarting(BenchmarkInfo const&) override;
|
||||||
void benchmarkEnded(BenchmarkStats<> const&) override;
|
void benchmarkEnded(BenchmarkStats<> const&) override;
|
||||||
void benchmarkFailed(std::string const&) override;
|
void benchmarkFailed( StringRef error ) override;
|
||||||
|
|
||||||
void listReporters(std::vector<ReporterDescription> const& descriptions) override;
|
void listReporters(std::vector<ReporterDescription> const& descriptions) override;
|
||||||
void listTests(std::vector<TestCaseHandle> const& tests) override;
|
void listTests(std::vector<TestCaseHandle> const& tests) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user