Googletest export

Add gmock Matcher<std::string_view> specialization.

PiperOrigin-RevId: 294443240
This commit is contained in:
Abseil Team
2020-02-11 11:22:17 -05:00
committed by Mark Barolak
parent d0930731d6
commit 6f5fd0d719
7 changed files with 197 additions and 164 deletions

View File

@@ -760,22 +760,22 @@ TEST(PrintTypeWithGenericStreamingTest, TypeImplicitlyConvertible) {
EXPECT_EQ("AllowsGenericStreamingAndImplicitConversionTemplate", Print(a));
}
#if GTEST_HAS_ABSL
#if GTEST_INTERNAL_HAS_STRING_VIEW
// Tests printing ::absl::string_view.
// Tests printing internal::StringView.
TEST(PrintStringViewTest, SimpleStringView) {
const ::absl::string_view sp = "Hello";
const internal::StringView sp = "Hello";
EXPECT_EQ("\"Hello\"", Print(sp));
}
TEST(PrintStringViewTest, UnprintableCharacters) {
const char str[] = "NUL (\0) and \r\t";
const ::absl::string_view sp(str, sizeof(str) - 1);
const internal::StringView sp(str, sizeof(str) - 1);
EXPECT_EQ("\"NUL (\\0) and \\r\\t\"", Print(sp));
}
#endif // GTEST_HAS_ABSL
#endif // GTEST_INTERNAL_HAS_STRING_VIEW
// Tests printing STL containers.