aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/ut/json_writer_ut.cpp
diff options
context:
space:
mode:
authoraligus <aligus@yandex-team.ru>2022-02-10 16:49:24 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:24 +0300
commitc2bb7445128368226bd179d54d6a238c9fd3065e (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/json/ut/json_writer_ut.cpp
parent3f79772915172a9f5407c1a815806a8c8ba67c60 (diff)
downloadydb-c2bb7445128368226bd179d54d6a238c9fd3065e.tar.gz
Restoring authorship annotation for <aligus@yandex-team.ru>. 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.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/json/ut/json_writer_ut.cpp b/library/cpp/json/ut/json_writer_ut.cpp
index cee42780ff..ca11d34dad 100644
--- a/library/cpp/json/ut/json_writer_ut.cpp
+++ b/library/cpp/json/ut/json_writer_ut.cpp
@@ -1,46 +1,46 @@
#include <library/cpp/json/json_writer.h>
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/stream/str.h>
-
-using namespace NJson;
-
+
+#include <util/stream/str.h>
+
+using namespace NJson;
+
Y_UNIT_TEST_SUITE(TJsonWriterTest) {
Y_UNIT_TEST(SimpleWriteTest) {
TString expected1 = "{\"key1\":1,\"key2\":2,\"key3\":3";
TString expected2 = expected1 + ",\"array\":[\"stroka\",false]";
TString expected3 = expected2 + "}";
-
+
TStringStream out;
-
+
TJsonWriter json(&out, false);
json.OpenMap();
json.Write("key1", (ui16)1);
json.WriteKey("key2");
json.Write((i32)2);
json.Write("key3", (ui64)3);
-
+
UNIT_ASSERT(out.Empty());
json.Flush();
UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected1);
-
+
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);
-
+
json.CloseMap();
-
+
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;
@@ -53,7 +53,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
TStringStream out;
WriteJson(&out, &v);
UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
- }
+ }
Y_UNIT_TEST(FormatOutput) {
TString expected = "{\n \"key1\":null,\n \"key2\":\n {\n \"subkey1\":\n [\n 1,\n {\n \"subsubkey\":\"test2\"\n },\n null,\n true\n ],\n \"subkey2\":\"test\"\n }\n}";
@@ -225,4 +225,4 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
UNIT_ASSERT_VALUES_EQUAL(actual, expected);
}
}
-}
+}