mirror of
https://github.com/google/googletest.git
synced 2025-12-07 01:06:50 +08:00
Add IsEmpty overload for C-style wide strings
This commit is contained in:
parent
279f847946
commit
1ffb761664
@ -79,6 +79,11 @@ class IsEmptyMatcher {
|
|||||||
return MatchAndExplain(std::string(s), listener);
|
return MatchAndExplain(std::string(s), listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Matches C-style wide strings.
|
||||||
|
bool MatchAndExplain(const wchar_t* s, MatchResultListener* listener) const {
|
||||||
|
return MatchAndExplain(std::wstring(s), listener);
|
||||||
|
}
|
||||||
|
|
||||||
// Describes what this matcher matches.
|
// Describes what this matcher matches.
|
||||||
void DescribeTo(std::ostream* os) const { *os << "is empty"; }
|
void DescribeTo(std::ostream* os) const { *os << "is empty"; }
|
||||||
|
|
||||||
|
|||||||
@ -1093,6 +1093,14 @@ TEST(IsEmptyTest, MatchesCString) {
|
|||||||
EXPECT_FALSE(m.Matches(b));
|
EXPECT_FALSE(m.Matches(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(IsEmptyTest, MatchesCWideString) {
|
||||||
|
const Matcher<const wchar_t*> m = IsEmpty();
|
||||||
|
const wchar_t a[] = L"";
|
||||||
|
const wchar_t b[] = L"x";
|
||||||
|
EXPECT_TRUE(m.Matches(a));
|
||||||
|
EXPECT_FALSE(m.Matches(b));
|
||||||
|
}
|
||||||
|
|
||||||
// Tests that IsNull() matches any NULL pointer of any type.
|
// Tests that IsNull() matches any NULL pointer of any type.
|
||||||
TEST(IsNullTest, MatchesNullPointer) {
|
TEST(IsNullTest, MatchesNullPointer) {
|
||||||
Matcher<int*> m1 = IsNull();
|
Matcher<int*> m1 = IsNull();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user