diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 9123176b341b6f2658cff5132482b8237c1416c8 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/json/ut/json_writer_ut.cpp | |
parent | 59e19371de37995fcb36beb16cd6ec030af960bc (diff) | |
download | ydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json/ut/json_writer_ut.cpp')
-rw-r--r-- | library/cpp/json/ut/json_writer_ut.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/library/cpp/json/ut/json_writer_ut.cpp b/library/cpp/json/ut/json_writer_ut.cpp index 9bbd4e3f77..ca11d34dad 100644 --- a/library/cpp/json/ut/json_writer_ut.cpp +++ b/library/cpp/json/ut/json_writer_ut.cpp @@ -11,48 +11,48 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { TString expected2 = expected1 + ",\"array\":[\"stroka\",false]"; TString expected3 = expected2 + "}"; - TStringStream out; + TStringStream out; - TJsonWriter json(&out, false); - json.OpenMap(); - json.Write("key1", (ui16)1); + TJsonWriter json(&out, false); + json.OpenMap(); + json.Write("key1", (ui16)1); json.WriteKey("key2"); json.Write((i32)2); - json.Write("key3", (ui64)3); + json.Write("key3", (ui64)3); UNIT_ASSERT(out.Empty()); - json.Flush(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected1); + json.Flush(); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected1); - json.Write("array"); - json.OpenArray(); - json.Write("stroka"); - json.Write(false); - json.CloseArray(); + json.Write("array"); + json.OpenArray(); + json.Write("stroka"); + json.Write(false); + json.CloseArray(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected1); - json.Flush(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected2); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected1); + json.Flush(); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected2); - json.CloseMap(); + json.CloseMap(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected2); - json.Flush(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected3); - } + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected2); + json.Flush(); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected3); + } Y_UNIT_TEST(SimpleWriteValueTest) { TString expected = "{\"key1\":null,\"key2\":{\"subkey1\":[1,{\"subsubkey\":\"test2\"},null,true],\"subkey2\":\"test\"}}"; - TJsonValue v; - v["key1"] = JSON_NULL; - v["key2"]["subkey1"].AppendValue(1); - v["key2"]["subkey1"].AppendValue(JSON_MAP)["subsubkey"] = "test2"; - v["key2"]["subkey1"].AppendValue(JSON_NULL); - v["key2"]["subkey1"].AppendValue(true); - v["key2"]["subkey2"] = "test"; - TStringStream out; - WriteJson(&out, &v); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); + TJsonValue v; + v["key1"] = JSON_NULL; + v["key2"]["subkey1"].AppendValue(1); + v["key2"]["subkey1"].AppendValue(JSON_MAP)["subsubkey"] = "test2"; + v["key2"]["subkey1"].AppendValue(JSON_NULL); + v["key2"]["subkey1"].AppendValue(true); + v["key2"]["subkey2"] = "test"; + TStringStream out; + WriteJson(&out, &v); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); } Y_UNIT_TEST(FormatOutput) { |