diff options
| author | Martin Hořeňovský | 2021-09-08 00:01:31 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-09-08 00:01:31 +0200 |
| commit | 29caae5ce544858d86d680b783d4c8a3126f3b5d (patch) | |
| tree | 0c0a04bc08bf9379e14dd6b22d392152363a5fce /src | |
| parent | ea49210eae6d04aae48d54bccc2a69776b3c6fd0 (diff) | |
| download | catch3-29caae5ce544858d86d680b783d4c8a3126f3b5d.tar.gz | |
Pass around the test suite name by StringRef
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/catch_config.cpp | 2 | ||||
| -rw-r--r-- | src/catch2/catch_config.hpp | 2 | ||||
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_config.hpp | 3 | ||||
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.cpp | 3 | ||||
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.hpp | 4 | ||||
| -rw-r--r-- | src/catch2/reporters/catch_reporter_teamcity.cpp | 4 |
6 files changed, 8 insertions, 10 deletions
diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp index e6a2f714..92fcff20 100644 --- a/src/catch2/catch_config.cpp +++ b/src/catch2/catch_config.cpp @@ -65,7 +65,7 @@ namespace Catch { // IConfig interface bool Config::allowThrows() const { return !m_data.noThrow; } std::ostream& Config::stream() const { return m_stream->stream(); } - std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } + StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; } bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); } bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } diff --git a/src/catch2/catch_config.hpp b/src/catch2/catch_config.hpp index 0fe94575..7daf61c7 100644 --- a/src/catch2/catch_config.hpp +++ b/src/catch2/catch_config.hpp @@ -89,7 +89,7 @@ namespace Catch { // IConfig interface bool allowThrows() const override; std::ostream& stream() const override; - std::string name() const override; + StringRef name() const override; bool includeSuccessfulResults() const override; bool warnAboutMissingAssertions() const override; bool warnAboutNoTests() const override; diff --git a/src/catch2/interfaces/catch_interfaces_config.hpp b/src/catch2/interfaces/catch_interfaces_config.hpp index f09b0c0f..60c4e9be 100644 --- a/src/catch2/interfaces/catch_interfaces_config.hpp +++ b/src/catch2/interfaces/catch_interfaces_config.hpp @@ -9,6 +9,7 @@ #define CATCH_INTERFACES_CONFIG_HPP_INCLUDED #include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/internal/catch_stringref.hpp> #include <chrono> #include <iosfwd> @@ -59,7 +60,7 @@ namespace Catch { virtual bool allowThrows() const = 0; virtual std::ostream& stream() const = 0; - virtual std::string name() const = 0; + virtual StringRef name() const = 0; virtual bool includeSuccessfulResults() const = 0; virtual bool shouldDebugBreak() const = 0; virtual bool warnAboutMissingAssertions() const = 0; diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp index 81892e82..22994309 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.cpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -29,9 +29,6 @@ namespace Catch { std::ostream& ReporterConfig::stream() const { return *m_stream; } IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; } - - TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {} - AssertionStats::AssertionStats( AssertionResult const& _assertionResult, std::vector<MessageInfo> const& _infoMessages, Totals const& _totals ) diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index 2e64d73e..09480f04 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -45,8 +45,8 @@ namespace Catch { }; struct TestRunInfo { - TestRunInfo( std::string const& _name ); - std::string name; + TestRunInfo(StringRef _name) : name(_name) {} + StringRef name; }; struct AssertionStats { diff --git a/src/catch2/reporters/catch_reporter_teamcity.cpp b/src/catch2/reporters/catch_reporter_teamcity.cpp index 6cb15d5d..ea67f75b 100644 --- a/src/catch2/reporters/catch_reporter_teamcity.cpp +++ b/src/catch2/reporters/catch_reporter_teamcity.cpp @@ -31,8 +31,8 @@ namespace Catch { .initialIndent(indent) << '\n'; } - std::string escape(std::string const& str) { - std::string escaped = str; + std::string escape(StringRef str) { + std::string escaped = static_cast<std::string>(str); replaceInPlace(escaped, "|", "||"); replaceInPlace(escaped, "'", "|'"); replaceInPlace(escaped, "\n", "|n"); |