Use StringRef for CasedString::caseSensitivitySuffix return type

This commit is contained in:
Martin Hořeňovský 2020-08-18 14:03:37 +02:00
parent f16be402f7
commit 2e480b6e56
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 6 additions and 5 deletions

View File

@ -21,10 +21,10 @@ namespace Matchers {
? toLower( str )
: str;
}
std::string CasedString::caseSensitivitySuffix() const {
return m_caseSensitivity == CaseSensitive::No
? " (case insensitive)"
: std::string();
StringRef CasedString::caseSensitivitySuffix() const {
return m_caseSensitivity == CaseSensitive::Yes
? StringRef()
: " (case insensitive)"_sr;
}

View File

@ -10,6 +10,7 @@
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/internal/catch_case_sensitive.hpp>
#include <catch2/internal/catch_stringref.hpp>
#include <string>
@ -19,7 +20,7 @@ namespace Matchers {
struct CasedString {
CasedString( std::string const& str, CaseSensitive caseSensitivity );
std::string adjustString( std::string const& str ) const;
std::string caseSensitivitySuffix() const;
StringRef caseSensitivitySuffix() const;
CaseSensitive m_caseSensitivity;
std::string m_str;