mirror of
https://github.com/google/googletest.git
synced 2025-04-07 06:25:01 +00:00
fix: explicitly copy-convert to std::string in StartsWith/EndsWith matchers
Instead of relying on automatic conversions, which won't happen if they're explicit!
This commit is contained in:
parent
a6d7fa8c0c
commit
c618dd98d0
1 changed files with 2 additions and 2 deletions
|
@ -1048,7 +1048,7 @@ class StartsWithMatcher {
|
|||
template <typename MatcheeStringType>
|
||||
bool MatchAndExplain(const MatcheeStringType& s,
|
||||
MatchResultListener* /* listener */) const {
|
||||
const StringType& s2(s);
|
||||
const StringType s2(s);
|
||||
return s2.length() >= prefix_.length() &&
|
||||
s2.substr(0, prefix_.length()) == prefix_;
|
||||
}
|
||||
|
@ -1102,7 +1102,7 @@ class EndsWithMatcher {
|
|||
template <typename MatcheeStringType>
|
||||
bool MatchAndExplain(const MatcheeStringType& s,
|
||||
MatchResultListener* /* listener */) const {
|
||||
const StringType& s2(s);
|
||||
const StringType s2(s);
|
||||
return s2.length() >= suffix_.length() &&
|
||||
s2.substr(s2.length() - suffix_.length()) == suffix_;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue