@@ -2282,6 +2282,20 @@ var _ = Describe("Commands", func() {
22822282 Expect (lRange .Val ()).To (Equal ([]string {"one" , "two" }))
22832283 })
22842284
2285+ It ("should RPopCount" , func () {
2286+ rPush := client .RPush (ctx , "list" , "one" , "two" , "three" , "four" )
2287+ Expect (rPush .Err ()).NotTo (HaveOccurred ())
2288+ Expect (rPush .Val ()).To (Equal (int64 (4 )))
2289+
2290+ rPopCount := client .RPopCount (ctx , "list" , 2 )
2291+ Expect (rPopCount .Err ()).NotTo (HaveOccurred ())
2292+ Expect (rPopCount .Val ()).To (Equal ([]string {"four" , "three" }))
2293+
2294+ lRange := client .LRange (ctx , "list" , 0 , - 1 )
2295+ Expect (lRange .Err ()).NotTo (HaveOccurred ())
2296+ Expect (lRange .Val ()).To (Equal ([]string {"one" , "two" }))
2297+ })
2298+
22852299 It ("should RPopLPush" , func () {
22862300 rPush := client .RPush (ctx , "list" , "one" )
22872301 Expect (rPush .Err ()).NotTo (HaveOccurred ())
@@ -4113,6 +4127,45 @@ var _ = Describe("Commands", func() {
41134127 }))
41144128 })
41154129
4130+ It ("should ZUnion" , func () {
4131+ err := client .ZAddArgs (ctx , "zset1" , redis.ZAddArgs {
4132+ Members : []redis.Z {
4133+ {Score : 1 , Member : "one" },
4134+ {Score : 2 , Member : "two" },
4135+ },
4136+ }).Err ()
4137+ Expect (err ).NotTo (HaveOccurred ())
4138+
4139+ err = client .ZAddArgs (ctx , "zset2" , redis.ZAddArgs {
4140+ Members : []redis.Z {
4141+ {Score : 1 , Member : "one" },
4142+ {Score : 2 , Member : "two" },
4143+ {Score : 3 , Member : "three" },
4144+ },
4145+ }).Err ()
4146+ Expect (err ).NotTo (HaveOccurred ())
4147+
4148+ union , err := client .ZUnion (ctx , redis.ZStore {
4149+ Keys : []string {"zset1" , "zset2" },
4150+ Weights : []float64 {2 , 3 },
4151+ Aggregate : "sum" ,
4152+ }).Result ()
4153+ Expect (err ).NotTo (HaveOccurred ())
4154+ Expect (union ).To (Equal ([]string {"one" , "three" , "two" }))
4155+
4156+ unionScores , err := client .ZUnionWithScores (ctx , redis.ZStore {
4157+ Keys : []string {"zset1" , "zset2" },
4158+ Weights : []float64 {2 , 3 },
4159+ Aggregate : "sum" ,
4160+ }).Result ()
4161+ Expect (err ).NotTo (HaveOccurred ())
4162+ Expect (unionScores ).To (Equal ([]redis.Z {
4163+ {Score : 5 , Member : "one" },
4164+ {Score : 9 , Member : "three" },
4165+ {Score : 10 , Member : "two" },
4166+ }))
4167+ })
4168+
41164169 It ("should ZUnionStore" , func () {
41174170 err := client .ZAdd (ctx , "zset1" , redis.Z {Score : 1 , Member : "one" }).Err ()
41184171 Expect (err ).NotTo (HaveOccurred ())
@@ -4339,6 +4392,33 @@ var _ = Describe("Commands", func() {
43394392 Expect (n ).To (Equal (int64 (3 )))
43404393 })
43414394
4395+ // TODO XTrimMaxLenApprox/XTrimMinIDApprox There is a bug in the limit parameter.
4396+ // TODO Don't test it for now.
4397+ // TODO link: https://github.com/redis/redis/issues/9046
4398+ It ("should XTrimMaxLen" , func () {
4399+ n , err := client .XTrimMaxLen (ctx , "stream" , 0 ).Result ()
4400+ Expect (err ).NotTo (HaveOccurred ())
4401+ Expect (n ).To (Equal (int64 (3 )))
4402+ })
4403+
4404+ It ("should XTrimMaxLenApprox" , func () {
4405+ n , err := client .XTrimMaxLenApprox (ctx , "stream" , 0 , 0 ).Result ()
4406+ Expect (err ).NotTo (HaveOccurred ())
4407+ Expect (n ).To (Equal (int64 (3 )))
4408+ })
4409+
4410+ It ("should XTrimMinID" , func () {
4411+ n , err := client .XTrimMinID (ctx , "stream" , "4-0" ).Result ()
4412+ Expect (err ).NotTo (HaveOccurred ())
4413+ Expect (n ).To (Equal (int64 (3 )))
4414+ })
4415+
4416+ It ("should XTrimMinIDApprox" , func () {
4417+ n , err := client .XTrimMinIDApprox (ctx , "stream" , "4-0" , 0 ).Result ()
4418+ Expect (err ).NotTo (HaveOccurred ())
4419+ Expect (n ).To (Equal (int64 (3 )))
4420+ })
4421+
43424422 It ("should XAdd" , func () {
43434423 id , err := client .XAdd (ctx , & redis.XAddArgs {
43444424 Stream : "stream" ,
0 commit comments