mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
Pass around the test suite name by StringRef
This commit is contained in:
parent
ea49210eae
commit
29caae5ce5
@ -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); }
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
@ -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 {
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user