Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions googlemock/include/gmock/gmock-more-matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"; }

Expand Down
8 changes: 8 additions & 0 deletions googlemock/test/gmock-matchers-comparisons_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down