Merge 1ffb761664edc0c696b636e18582fe4d25616d01 into d72f9c8aea6817cdf1ca0ac10887f328de7f3da2

This commit is contained in:
Jimmy Zhang 2026-03-31 11:33:35 -04:00 committed by GitHub
commit 949f6ca4a6
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 [[nodiscard]] 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

@ -1094,6 +1094,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();