diff options
author | ilvin <ilvin@yandex-team.ru> | 2022-02-10 16:50:26 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:26 +0300 |
commit | ca2601638cd3dbdbbfac14df5bf3423774a7ec03 (patch) | |
tree | ee920546dd1c0a680d9d2d07028f979169fd16eb | |
parent | 2b7a11999a854601a22b47b483fd03a7de5bfd90 (diff) | |
download | ydb-ca2601638cd3dbdbbfac14df5bf3423774a7ec03.tar.gz |
Restoring authorship annotation for <ilvin@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/json/writer/json_value_ut.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp index dc7f6affdf..f3b29a5423 100644 --- a/library/cpp/json/writer/json_value_ut.cpp +++ b/library/cpp/json/writer/json_value_ut.cpp @@ -286,59 +286,59 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) { } Y_UNIT_TEST(GetValueByPathConstTest) { - TJsonValue lhs; - TJsonValue first; - TJsonValue second; - TJsonValue last; - first.InsertValue("e", "f"); - second.InsertValue("c", first); - last.InsertValue("a", second); - lhs.InsertValue("l", last); - - { - const TJsonValue* result = lhs.GetValueByPath("l", '/'); - UNIT_ASSERT_EQUAL(*result, last); - } - { - const TJsonValue* result = lhs.GetValueByPath("l/a", '/'); - UNIT_ASSERT_EQUAL(*result, second); - } - { - const TJsonValue* result = lhs.GetValueByPath("l/a/c", '/'); - UNIT_ASSERT_EQUAL(*result, first); - } - { - const TJsonValue* result = lhs.GetValueByPath("l.a.c.e", '.'); - UNIT_ASSERT_EQUAL(*result, "f"); - } - { - const TJsonValue* result = lhs.GetValueByPath("l/a/c/e/x", '/'); - UNIT_ASSERT_EQUAL(result, nullptr); - } - { - const TJsonValue* result = lhs.GetValueByPath("a/c/e/x", '/'); - UNIT_ASSERT_EQUAL(result, nullptr); - } - { - const TJsonValue* result = lhs.GetValueByPath("nokey", '/'); - UNIT_ASSERT_EQUAL(result, nullptr); - } - { - const TJsonValue* result = lhs.GetValueByPath("", '/'); + TJsonValue lhs; + TJsonValue first; + TJsonValue second; + TJsonValue last; + first.InsertValue("e", "f"); + second.InsertValue("c", first); + last.InsertValue("a", second); + lhs.InsertValue("l", last); + + { + const TJsonValue* result = lhs.GetValueByPath("l", '/'); + UNIT_ASSERT_EQUAL(*result, last); + } + { + const TJsonValue* result = lhs.GetValueByPath("l/a", '/'); + UNIT_ASSERT_EQUAL(*result, second); + } + { + const TJsonValue* result = lhs.GetValueByPath("l/a/c", '/'); + UNIT_ASSERT_EQUAL(*result, first); + } + { + const TJsonValue* result = lhs.GetValueByPath("l.a.c.e", '.'); + UNIT_ASSERT_EQUAL(*result, "f"); + } + { + const TJsonValue* result = lhs.GetValueByPath("l/a/c/e/x", '/'); + UNIT_ASSERT_EQUAL(result, nullptr); + } + { + const TJsonValue* result = lhs.GetValueByPath("a/c/e/x", '/'); + UNIT_ASSERT_EQUAL(result, nullptr); + } + { + const TJsonValue* result = lhs.GetValueByPath("nokey", '/'); + UNIT_ASSERT_EQUAL(result, nullptr); + } + { + const TJsonValue* result = lhs.GetValueByPath("", '/'); UNIT_ASSERT_EQUAL(*result, lhs); // itself - } - - TJsonValue array; - TJsonValue third; - array[0] = first; - array[1] = second; - third["t"] = array; - - UNIT_ASSERT(array.GetValueByPath("[0].e", '.')->GetStringRobust() == "f"); + } + + TJsonValue array; + TJsonValue third; + array[0] = first; + array[1] = second; + third["t"] = array; + + UNIT_ASSERT(array.GetValueByPath("[0].e", '.')->GetStringRobust() == "f"); UNIT_ASSERT(third.GetValueByPath("t.[0].e", '.')->GetStringRobust() == "f"); UNIT_ASSERT(third.GetValueByPath("t.[1].c.e", '.')->GetStringRobust() == "f"); - } - + } + Y_UNIT_TEST(EraseValueFromArray) { { TJsonValue vec; |