Commit 3c028685 authored by miloyip's avatar miloyip

Add tests for Writer API for RAPIDJSON_HAS_STDSTRING

parent 3d82781a
......@@ -79,3 +79,14 @@ TEST(PrettyWriter, SetIndent) {
"}",
buffer.GetString());
}
#if RAPIDJSON_HAS_STDSTRING
TEST(PrettyWriter, String_STDSTRING) {
StringBuffer buffer;
PrettyWriter<StringBuffer> writer(buffer);
EXPECT_TRUE(writer.StartArray());
EXPECT_TRUE(writer.String(std::string("Hello\n")));
EXPECT_TRUE(writer.EndArray());
EXPECT_STREQ("[\n \"Hello\\n\"\n]", buffer.GetString());
}
#endif
......@@ -89,6 +89,15 @@ TEST(Writer, String) {
TEST_ROUNDTRIP("[\"Hello\"]");
TEST_ROUNDTRIP("[\"Hello\\u0000World\"]");
TEST_ROUNDTRIP("[\"\\\"\\\\/\\b\\f\\n\\r\\t\"]");
#if RAPIDJSON_HAS_STDSTRING
{
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
writer.String(std::string("Hello\n"));
EXPECT_STREQ("\"Hello\\n\"", buffer.GetString());
}
#endif
}
TEST(Writer, Double) {
......
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