20 #include <type_traits> 22 #include "gtest/gtest.h" 26 TEST(OStringStream, IsOStream) {
28 std::is_base_of<std::ostream, absl::strings_internal::OStringStream>(),
32 TEST(OStringStream, ConstructDestroy) {
35 EXPECT_EQ(
nullptr, strm.str());
38 std::string s =
"abc";
41 EXPECT_EQ(&s, strm.str());
46 std::unique_ptr<std::string> s(
new std::string);
52 TEST(OStringStream, Str) {
57 static_assert(std::is_same<decltype(strm.str()), std::string*>(),
"");
58 static_assert(std::is_same<decltype(c_strm.str()),
const std::string*>(),
"");
60 EXPECT_EQ(&s1, strm.str());
61 EXPECT_EQ(&s1, c_strm.str());
64 EXPECT_EQ(&s1, strm.str());
65 EXPECT_EQ(&s1, c_strm.str());
69 EXPECT_EQ(&s2, strm.str());
70 EXPECT_EQ(&s2, c_strm.str());
73 EXPECT_EQ(
nullptr, strm.str());
74 EXPECT_EQ(
nullptr, c_strm.str());
77 TEST(OStreamStream, WriteToLValue) {
78 std::string s =
"abc";
85 EXPECT_EQ(
"abc42", s);
87 EXPECT_EQ(
"abc42xy", s);
89 EXPECT_EQ(
"abc42xy", s);
92 TEST(OStreamStream, WriteToRValue) {
93 std::string s =
"abc";
97 EXPECT_EQ(
"abc42", s);
99 EXPECT_EQ(
"abc42xy", s);
TEST(Symbolize, Unimplemented)