Commit 0761ac12 authored by Milo Yip's avatar Milo Yip

Remove lambda expression in (pretty)writertest

parent f28203c7
......@@ -208,17 +208,18 @@ TEST(PrettyWriter, RawValue) {
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
static PrettyWriter<StringBuffer> WriterGen(StringBuffer &target) {
PrettyWriter<StringBuffer> writer(target);
writer.StartObject();
writer.Key("a");
writer.Int(1);
return std::move(writer);
}
TEST(PrettyWriter, MoveCtor) {
StringBuffer buffer;
auto writerGen=[](StringBuffer &target) -> PrettyWriter<StringBuffer> {
PrettyWriter<StringBuffer> writer(target);
writer.StartObject();
writer.Key("a");
writer.Int(1);
return std::move(writer);
};
PrettyWriter<StringBuffer> writer(writerGen(buffer));
PrettyWriter<StringBuffer> writer(WriterGen(buffer));
writer.EndObject();
EXPECT_TRUE(writer.IsComplete());
EXPECT_STREQ(
......
......@@ -502,17 +502,17 @@ TEST(Writer, RawValue) {
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
static Writer<StringBuffer> WriterGen(StringBuffer &target) {
Writer<StringBuffer> writer(target);
writer.StartObject();
writer.Key("a");
writer.Int(1);
return std::move(writer);
}
TEST(Writer, MoveCtor) {
StringBuffer buffer;
auto writerGen=[](StringBuffer &target) -> Writer<StringBuffer> {
Writer<StringBuffer> writer(target);
writer.StartObject();
writer.Key("a");
writer.Int(1);
return std::move(writer);
};
Writer<StringBuffer> writer(writerGen(buffer));
Writer<StringBuffer> writer(WriterGen(buffer));
writer.EndObject();
EXPECT_TRUE(writer.IsComplete());
EXPECT_STREQ("{\"a\":1}", buffer.GetString());
......
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