From af22eeab7242d0cc972637650e096e6a244b89ca Mon Sep 17 00:00:00 2001 From: Mixficsol <838844609@qq.com> Date: Mon, 20 Nov 2023 15:41:58 +0800 Subject: [PATCH] add go gest (#2126) Co-authored-by: wuxianrong --- tests/integration/hash_test.go | 12 +++++++++++- tests/integration/set_test.go | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/integration/hash_test.go b/tests/integration/hash_test.go index 6cd0c3c9c9..45e864bb69 100644 --- a/tests/integration/hash_test.go +++ b/tests/integration/hash_test.go @@ -10,7 +10,7 @@ import ( "github.com/redis/go-redis/v9" ) -var _ = Describe("List Commands", func() { +var _ = Describe("Hash Commands", func() { ctx := context.TODO() var client *redis.Client @@ -308,6 +308,16 @@ var _ = Describe("List Commands", func() { Expect(slice).To(Equal([]string{"hello1", "hello2"})) }) + It("should HSTRLEN", func() { + hSet := client.HSet(ctx, "hash", "key1", "hello1") + Expect(hSet.Err()).NotTo(HaveOccurred()) + + hGet := client.HGet(ctx, "hash", "key1") + Expect(hGet.Err()).NotTo(HaveOccurred()) + length := client.Do(ctx, "hstrlen", "hash", "key1") + + Expect(length.Val()).To(Equal(int64(len("hello1")))) + }) //It("should HRandField", func() { // err := client.HSet(ctx, "hash", "key1", "hello1").Err() // Expect(err).NotTo(HaveOccurred()) diff --git a/tests/integration/set_test.go b/tests/integration/set_test.go index 8e765e4c7a..0d6c4d0125 100644 --- a/tests/integration/set_test.go +++ b/tests/integration/set_test.go @@ -9,7 +9,7 @@ import ( "github.com/redis/go-redis/v9" ) -var _ = Describe("List Commands", func() { +var _ = Describe("Set Commands", func() { ctx := context.TODO() var client *redis.Client