aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/yson_string/unittests/saveload_ut.cpp
diff options
context:
space:
mode:
authoryurial <yurial@yandex-team.com>2023-11-16 13:59:02 +0300
committeryurial <yurial@yandex-team.com>2023-11-16 14:43:37 +0300
commita2fd00a24fcb20211418b797cb6191c4f1afa6ea (patch)
tree68e33195baef03090a66c0e3868c89bfd2268480 /library/cpp/yt/yson_string/unittests/saveload_ut.cpp
parentcab414f768af417824e8def2b045b5f13c5e7931 (diff)
downloadydb-a2fd00a24fcb20211418b797cb6191c4f1afa6ea.tar.gz
Support Save/Load TYsonString
Diffstat (limited to 'library/cpp/yt/yson_string/unittests/saveload_ut.cpp')
-rw-r--r--library/cpp/yt/yson_string/unittests/saveload_ut.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/library/cpp/yt/yson_string/unittests/saveload_ut.cpp b/library/cpp/yt/yson_string/unittests/saveload_ut.cpp
new file mode 100644
index 0000000000..33a98a30ea
--- /dev/null
+++ b/library/cpp/yt/yson_string/unittests/saveload_ut.cpp
@@ -0,0 +1,46 @@
+#include <library/cpp/testing/gtest/gtest.h>
+
+#include <library/cpp/testing/gtest_extensions/assertions.h>
+
+#include <library/cpp/yt/yson_string/string.h>
+
+namespace NYT::NYson {
+namespace {
+
+////////////////////////////////////////////////////////////////////////////////
+
+TEST(TYsonStringTest, SaveLoadNull)
+{
+ const TYsonString expected;
+ TStringStream s;
+ ::Save(&s, expected);
+ TYsonString result;
+ ::Load(&s, result);
+ EXPECT_EQ(expected, result);
+}
+
+TEST(TYsonStringTest, SaveLoadString)
+{
+ const TYsonString expected(TString("My tests data"));
+ TStringStream s;
+ ::Save(&s, expected);
+ TYsonString result;
+ ::Load(&s, result);
+ EXPECT_EQ(expected, result);
+}
+
+TEST(TYsonStringTest, SaveLoadSharedRef)
+{
+ TSharedRef ref = TSharedRef::FromString("My tests data");
+ const TYsonString expected(ref);
+ TStringStream s;
+ ::Save(&s, expected);
+ TYsonString result;
+ ::Load(&s, result);
+ EXPECT_EQ(expected, result);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace
+} // namespace NYT::NYson