aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json/ut/proto2json_ut.cpp
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-10-02 11:40:21 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-10-02 11:40:21 +0000
commit4a43f3fbfda5a2eee2af081bd76ae023afd481db (patch)
treeae27208d4452705b2c0ec19efdcd8132c8e8de20 /library/cpp/protobuf/json/ut/proto2json_ut.cpp
parent2a5dadb53a806ed944a3a3e1dfcaef886838360d (diff)
parent2084bac66bb1c8d3013d8ef6c61867726c4188e2 (diff)
downloadydb-4a43f3fbfda5a2eee2af081bd76ae023afd481db.tar.gz
Merge branch 'rightlib' into mergelibs-241002-1139
Diffstat (limited to 'library/cpp/protobuf/json/ut/proto2json_ut.cpp')
-rw-r--r--library/cpp/protobuf/json/ut/proto2json_ut.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
index 9e98ab8a06..f5bcfac49d 100644
--- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp
+++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
@@ -997,6 +997,24 @@ Y_UNIT_TEST(TestMapUsingGeneratedAsJSON) {
UNIT_ASSERT_JSON_STRINGS_EQUAL(jsonStr.Str(), modelStr);
} // TestMapUsingGeneratedAsJSON
+Y_UNIT_TEST(TestMapSortedKeys) {
+ TMapType proto;
+
+ auto& items = *proto.MutableItems();
+ items["key1"] = "value1";
+ items["key2"] = "value2";
+ items["key3"] = "value3";
+
+ TString modelStr(R"_({"Items":{"key1":"value1","key2":"value2","key3":"value3"}})_");
+
+ TStringStream jsonStr;
+
+ auto config = TProto2JsonConfig().SetMapAsObject(true).SetSortMapKeys(false);
+ UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, jsonStr, config));
+
+ UNIT_ASSERT_JSON_STRINGS_EQUAL(jsonStr.Str(), modelStr);
+} // TestMapSortedKeys
+
Y_UNIT_TEST(TestMapDefaultValue) {
TMapType proto;