blob: 33a98a30ea4d8905b052c9e36167819d21810686 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
|