Merge 1ffb761664edc0c696b636e18582fe4d25616d01 into 1b96fa13f549387b7549cc89e1a785cf143a1a50

This commit is contained in:
Jimmy Zhang 2025-11-12 14:15:49 -05:00 committed by GitHub
commit f93d9624df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -79,6 +79,11 @@ class IsEmptyMatcher {
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.
void DescribeTo(std::ostream* os) const { *os << "is empty"; }

View File

@ -1093,6 +1093,14 @@ TEST(IsEmptyTest, MatchesCString) {
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.
TEST(IsNullTest, MatchesNullPointer) {
Matcher<int*> m1 = IsNull();