Commit c9eabf9e authored by Lele Gaifax's avatar Lele Gaifax

Extend the test on issue #1336 to cover all basic types

parent 3fc9299b
...@@ -340,14 +340,32 @@ TEST(PrettyWriter, MoveCtor) { ...@@ -340,14 +340,32 @@ TEST(PrettyWriter, MoveCtor) {
#endif #endif
TEST(PrettyWriter, Issue_1336) { TEST(PrettyWriter, Issue_1336) {
char buf[100] = "Hello"; #define T(meth, val, expected) \
{ \
StringBuffer buffer; \
PrettyWriter<StringBuffer> writer(buffer); \
writer.meth(val); \
\
EXPECT_STREQ(expected, buffer.GetString()); \
EXPECT_TRUE(writer.IsComplete()); \
}
T(Bool, false, "false");
T(Bool, true, "true");
T(Int, 0, "0");
T(Uint, 0, "0");
T(Int64, 0, "0");
T(Uint64, 0, "0");
T(Double, 0, "0.0");
T(String, "Hello", "\"Hello\"");
#undef T
StringBuffer buffer; StringBuffer buffer;
PrettyWriter<StringBuffer> writer(buffer); PrettyWriter<StringBuffer> writer(buffer);
writer.String(buf); writer.Null();
EXPECT_STREQ("\"Hello\"", buffer.GetString()); EXPECT_STREQ("null", buffer.GetString());
EXPECT_TRUE(writer.IsComplete()); \ EXPECT_TRUE(writer.IsComplete());
} }
#ifdef __clang__ #ifdef __clang__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment