diff options
| author | mvel <[email protected]> | 2026-03-19 07:43:44 +0300 |
|---|---|---|
| committer | mvel <[email protected]> | 2026-03-19 08:29:50 +0300 |
| commit | 09f4d6f7c5d2bde0fce52df4a1b8b369fe44967c (patch) | |
| tree | 79eb3e960accb09d9b1e90135c088e53e33f2fef /library/cpp/json/writer/json_value_ut.cpp | |
| parent | 1916d58b6659a020b96f8cd1f6740cbcc496cee7 (diff) | |
[json] Add non-const version of `GetStringSafe` method (relates)
Странно, что такого метода не было. А он полезен, если хочешь хачить уже имеющуюся структуру.
commit_hash:09763c7c08d149a27867a4cf5908b694b3024e99
Diffstat (limited to 'library/cpp/json/writer/json_value_ut.cpp')
| -rw-r--r-- | library/cpp/json/writer/json_value_ut.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp index 21b396a64de..e804e541ccf 100644 --- a/library/cpp/json/writer/json_value_ut.cpp +++ b/library/cpp/json/writer/json_value_ut.cpp @@ -682,4 +682,12 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) { UNIT_ASSERT_VALUES_EQUAL(filled["4"].GetMapSafe().size(), 1); UNIT_ASSERT_VALUES_EQUAL(filled["4"]["5"], TJsonValue{5}); } + + Y_UNIT_TEST(GetStringSafeTest) { + TJsonValue json; + json["key"] = "value"; + TString& valueRef = json["key"].GetStringSafe(); + valueRef = "new_value"; + UNIT_ASSERT_VALUES_EQUAL(json["key"].GetString(), "new_value"); + } } // Y_UNIT_TEST_SUITE(TJsonValueTest) |
