Skip to content

Commit

Permalink
fix ba to be
Browse files Browse the repository at this point in the history
  • Loading branch information
guojidan committed Oct 24, 2023
1 parent dde3e7c commit 0d119c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/cppunit/types/json_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ TEST_F(RedisJsonTest, Clear) {

TEST_F(RedisJsonTest, StrAppend) {
ASSERT_TRUE(json_->Set(key_, "$", R"({"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}})").ok());
ASSERT_TRUE(json_->StrAppend(key_, "$.a", "ba", append_cnt_).ok());
ASSERT_TRUE(json_->StrAppend(key_, "$.a", "be", append_cnt_).ok());
ASSERT_EQ(append_cnt_.size(), 1);
ASSERT_EQ(append_cnt_[0], 5);

append_cnt_.clear();
ASSERT_TRUE(json_->Set(key_, "$", R"({"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}})").ok());
ASSERT_TRUE(json_->StrAppend(key_, "$..a", "ba", append_cnt_).ok());
ASSERT_TRUE(json_->StrAppend(key_, "$..a", "be", append_cnt_).ok());
ASSERT_EQ(append_cnt_.size(), 3);
int64_t result1[] = {5, 7, -1};
for (int i = 0; i < 3; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions tests/gocase/unit/type/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ func TestJson(t *testing.T) {
var result1 = make([]interface{}, 0)
result1 = append(result1, int64(5))
require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", `{"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}}`).Err())
require.Equal(t, rdb.Do(ctx, "JSON.STRAPPEND", "a", "$.a", "ba").Val(), result1)
require.Equal(t, rdb.Do(ctx, "JSON.STRAPPEND", "a", "$.a", "be").Val(), result1)

var result2 = make([]interface{}, 0)
result2 = append(result2, int64(5), int64(7), interface {}(nil))
require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", `{"a":"foo", "nested": {"a": "hello"}, "nested2": {"a": 31}}`).Err())
require.Equal(t, rdb.Do(ctx, "JSON.STRAPPEND", "a", "$..a", "ba").Val(), result2)
require.Equal(t, rdb.Do(ctx, "JSON.STRAPPEND", "a", "$..a", "be").Val(), result2)
})

t.Run("JSON.STRLEN basics", func(t *testing.T) {
Expand Down

0 comments on commit 0d119c3

Please sign in to comment.