aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/writer
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:39 +0300
commita6a92afe03e02795227d2641b49819b687f088f8 (patch)
treef6984a1d27d5a7ec88a6fdd6e20cd5b7693b6ece /library/cpp/json/writer
parentc6dc8b8bd530985bc4cce0137e9a5de32f1087cb (diff)
downloadydb-a6a92afe03e02795227d2641b49819b687f088f8.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/writer')
-rw-r--r--library/cpp/json/writer/json_value.cpp2
-rw-r--r--library/cpp/json/writer/json_value_ut.cpp52
2 files changed, 27 insertions, 27 deletions
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp
index c61e8d1dc4..c574ee2d8c 100644
--- a/library/cpp/json/writer/json_value.cpp
+++ b/library/cpp/json/writer/json_value.cpp
@@ -504,7 +504,7 @@ namespace NJson {
TJsonValue::TMapType& TJsonValue::GetMapSafe() {
return const_cast<TJsonValue::TMapType&>(const_cast<const TJsonValue*>(this)->GetMapSafe());
}
-
+
const TJsonValue::TArray& TJsonValue::GetArraySafe() const {
if (Type != JSON_ARRAY)
ythrow TJsonException() << "Not an array";
diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp
index dc7f6affdf..e064fbc785 100644
--- a/library/cpp/json/writer/json_value_ut.cpp
+++ b/library/cpp/json/writer/json_value_ut.cpp
@@ -476,34 +476,34 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {
UNIT_ASSERT(false);
}
}
-
- {
- // Check non-const GetArraySafe()
- TJsonValue json{JSON_ARRAY};
- json.GetArraySafe().push_back(TJsonValue{"foo"});
-
- TJsonValue expectedJson;
- expectedJson.AppendValue(TJsonValue{"foo"});
- UNIT_ASSERT(json == expectedJson);
-
- TJsonValue::TArray jsonArray = std::move(json.GetArraySafe());
- TJsonValue::TArray expectedArray = {TJsonValue{"foo"}};
- UNIT_ASSERT(jsonArray == expectedArray);
- }
-
- {
- // Check non-const GetMap()
- TJsonValue json{JSON_MAP};
- json.GetMapSafe()["foo"] = "bar";
-
- TJsonValue expectedJson;
- expectedJson.InsertValue("foo", "bar");
- UNIT_ASSERT(json == expectedJson);
-
+
+ {
+ // Check non-const GetArraySafe()
+ TJsonValue json{JSON_ARRAY};
+ json.GetArraySafe().push_back(TJsonValue{"foo"});
+
+ TJsonValue expectedJson;
+ expectedJson.AppendValue(TJsonValue{"foo"});
+ UNIT_ASSERT(json == expectedJson);
+
+ TJsonValue::TArray jsonArray = std::move(json.GetArraySafe());
+ TJsonValue::TArray expectedArray = {TJsonValue{"foo"}};
+ UNIT_ASSERT(jsonArray == expectedArray);
+ }
+
+ {
+ // Check non-const GetMap()
+ TJsonValue json{JSON_MAP};
+ json.GetMapSafe()["foo"] = "bar";
+
+ TJsonValue expectedJson;
+ expectedJson.InsertValue("foo", "bar");
+ UNIT_ASSERT(json == expectedJson);
+
TJsonValue::TMapType jsonMap = std::move(json.GetMapSafe());
TJsonValue::TMapType expectedMap = {{"foo", TJsonValue{"bar"}}};
- UNIT_ASSERT(jsonMap == expectedMap);
- }
+ UNIT_ASSERT(jsonMap == expectedMap);
+ }
}
Y_UNIT_TEST(NonexistentFieldAccessTest) {