diff --git a/src/catch2/interfaces/catch_interfaces_capture.hpp b/src/catch2/interfaces/catch_interfaces_capture.hpp index b77b4d85..2e7a631f 100644 --- a/src/catch2/interfaces/catch_interfaces_capture.hpp +++ b/src/catch2/interfaces/catch_interfaces_capture.hpp @@ -44,10 +44,10 @@ namespace Catch { 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 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 popScopedMessage( MessageInfo const& message ) = 0; diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index 5a4c31a8..aeb78b61 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -201,10 +201,10 @@ namespace Catch { virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 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 benchmarkEnded( BenchmarkStats<> const& ) {} - virtual void benchmarkFailed( std::string const& ) {} + virtual void benchmarkFailed( StringRef ) {} virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index 82235c4e..1e2d1031 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -316,7 +316,7 @@ namespace Catch { m_unfinishedSections.push_back(endInfo); } - void RunContext::benchmarkPreparing(std::string const& name) { + void RunContext::benchmarkPreparing( StringRef name ) { m_reporter->benchmarkPreparing(name); } void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { @@ -325,8 +325,8 @@ namespace Catch { void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) { m_reporter->benchmarkEnded( stats ); } - void RunContext::benchmarkFailed(std::string const & error) { - m_reporter->benchmarkFailed(error); + void RunContext::benchmarkFailed( StringRef error ) { + m_reporter->benchmarkFailed( error ); } void RunContext::pushScopedMessage(MessageInfo const & message) { diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp index 5f91ddda..b2eeb2ee 100644 --- a/src/catch2/internal/catch_run_context.hpp +++ b/src/catch2/internal/catch_run_context.hpp @@ -77,10 +77,10 @@ namespace Catch { 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 benchmarkEnded( BenchmarkStats<> const& stats ) override; - void benchmarkFailed( std::string const& error ) override; + void benchmarkFailed( StringRef error ) override; void pushScopedMessage( MessageInfo const& message ) override; void popScopedMessage( MessageInfo const& message ) override; diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index 80036d27..d2779e34 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -434,10 +434,12 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { StreamingReporterBase::sectionEnded(_sectionStats); } -void ConsoleReporter::benchmarkPreparing(std::string const& name) { +void ConsoleReporter::benchmarkPreparing( StringRef name ) { lazyPrintWithoutClosingBenchmarkTable(); - auto nameCol = TextFlow::Column(name).width(static_cast(m_tablePrinter->columnInfos()[0].width - 2)); + auto nameCol = TextFlow::Column( static_cast( name ) ) + .width( static_cast( + m_tablePrinter->columnInfos()[0].width - 2 ) ); bool firstLine = true; 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); (*m_tablePrinter) << "Benchmark failed (" << error << ')' diff --git a/src/catch2/reporters/catch_reporter_console.hpp b/src/catch2/reporters/catch_reporter_console.hpp index e446d8cc..b61e3115 100644 --- a/src/catch2/reporters/catch_reporter_console.hpp +++ b/src/catch2/reporters/catch_reporter_console.hpp @@ -42,10 +42,10 @@ namespace Catch { void sectionStarting(SectionInfo const& _sectionInfo) 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 benchmarkEnded(BenchmarkStats<> const& stats) override; - void benchmarkFailed(std::string const& error) override; + void benchmarkFailed( StringRef error ) override; void testCaseEnded(TestCaseStats const& _testCaseStats) override; void testGroupEnded(TestGroupStats const& _testGroupStats) override; diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_listening.cpp index e048a656..49ab93f7 100644 --- a/src/catch2/reporters/catch_reporter_listening.cpp +++ b/src/catch2/reporters/catch_reporter_listening.cpp @@ -35,7 +35,7 @@ namespace Catch { m_reporter->reportInvalidArguments( arg ); } - void ListeningReporter::benchmarkPreparing( std::string const& name ) { + void ListeningReporter::benchmarkPreparing( StringRef name ) { for (auto& listener : m_listeners) { listener->benchmarkPreparing(name); } @@ -54,7 +54,7 @@ namespace Catch { m_reporter->benchmarkEnded( benchmarkStats ); } - void ListeningReporter::benchmarkFailed( std::string const& error ) { + void ListeningReporter::benchmarkFailed( StringRef error ) { for (auto& listener : m_listeners) { listener->benchmarkFailed(error); } diff --git a/src/catch2/reporters/catch_reporter_listening.hpp b/src/catch2/reporters/catch_reporter_listening.hpp index 88234cdc..114a63a4 100644 --- a/src/catch2/reporters/catch_reporter_listening.hpp +++ b/src/catch2/reporters/catch_reporter_listening.hpp @@ -34,10 +34,10 @@ namespace Catch { 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 benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; - void benchmarkFailed(std::string const&) override; + void benchmarkFailed( StringRef error ) override; void testRunStarting( TestRunInfo const& testRunInfo ) override; void testGroupStarting( GroupInfo const& groupInfo ) override; diff --git a/src/catch2/reporters/catch_reporter_xml.cpp b/src/catch2/reporters/catch_reporter_xml.cpp index 6e1e6979..527ad201 100644 --- a/src/catch2/reporters/catch_reporter_xml.cpp +++ b/src/catch2/reporters/catch_reporter_xml.cpp @@ -229,9 +229,9 @@ namespace Catch { m_xml.endElement(); } - void XmlReporter::benchmarkPreparing(std::string const& name) { + void XmlReporter::benchmarkPreparing( StringRef name ) { m_xml.startElement("BenchmarkResults") - .writeAttribute("name"_sr, name); + .writeAttribute("name"_sr, name); } void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) { @@ -266,7 +266,7 @@ namespace Catch { m_xml.endElement(); } - void XmlReporter::benchmarkFailed(std::string const &error) { + void XmlReporter::benchmarkFailed(StringRef error) { m_xml.scopedElement("failed"). writeAttribute("message"_sr, error); m_xml.endElement(); diff --git a/src/catch2/reporters/catch_reporter_xml.hpp b/src/catch2/reporters/catch_reporter_xml.hpp index dbcaaa93..00a4006b 100644 --- a/src/catch2/reporters/catch_reporter_xml.hpp +++ b/src/catch2/reporters/catch_reporter_xml.hpp @@ -51,10 +51,10 @@ namespace Catch { void testRunEnded(TestRunStats const& testRunStats) override; - void benchmarkPreparing(std::string const& name) override; + void benchmarkPreparing( StringRef name ) override; void benchmarkStarting(BenchmarkInfo const&) override; void benchmarkEnded(BenchmarkStats<> const&) override; - void benchmarkFailed(std::string const&) override; + void benchmarkFailed( StringRef error ) override; void listReporters(std::vector const& descriptions) override; void listTests(std::vector const& tests) override;