mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
test(rdb): Add json dump & restore test (#678)
This commit is contained in:
parent
cee7a9e67d
commit
7b7e3ea9d4
1 changed files with 18 additions and 0 deletions
|
@ -316,4 +316,22 @@ TEST_F(RdbTest, HMapBugs) {
|
|||
EXPECT_EQ(2, CheckedInt({"hlen", "hmap1"}));
|
||||
}
|
||||
|
||||
TEST_F(RdbTest, JsonTest) {
|
||||
string_view data[] = {
|
||||
R"({"a":1})"sv, //
|
||||
R"([1,2,3,4,5,6])"sv, //
|
||||
R"({"a":1.0,"b":[1,2],"c":"value"})"sv, //
|
||||
R"({"a":{"a":{"a":{"a":1}}}})"sv //
|
||||
};
|
||||
|
||||
for (auto test : data) {
|
||||
Run({"json.set", "doc", "$", test});
|
||||
auto dump = Run({"dump", "doc"});
|
||||
Run({"del", "doc"});
|
||||
Run({"restore", "doc", "0", facade::ToSV(dump.GetBuf())});
|
||||
auto res = Run({"json.get", "doc"});
|
||||
ASSERT_EQ(res, test);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dfly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue