aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:40 +0300
commit5d50718e66d9c037dc587a0211110b7d25a66185 (patch)
treee98df59de24d2ef7c77baed9f41e4875a2fef972 /library/cpp/json
parenta6a92afe03e02795227d2641b49819b687f088f8 (diff)
downloadydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json')
-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 c574ee2d8c..c61e8d1dc4 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 e064fbc785..dc7f6affdf 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) {