Skip to content

Commit d8e90d7

Browse files
committed
test(redis): 更新zrange测试用例以支持LIMIT选项- 修改测试注释,明确LIMIT需与BYSCORE或BYLEX组合使用
- 调整zrange调用方式,添加sortByScore()方法 - 更新断言逻辑,适配新的返回值结构 - 保持测试数据清理逻辑不变
1 parent 432b1fe commit d8e90d7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/java/tech/smartboot/redisun/test/RedisunTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ public void testZRangeCommand() {
375375
// 注意:WITHSCORES 选项在同步方法中无法直接测试,因为它会改变返回值类型
376376
// 我们会在异步方法中测试这个功能
377377

378-
// 测试 LIMIT 选项
379-
result1 = redisun.zrange(key, 0, -1, cmd -> cmd.limit(1, 2));
378+
// 测试 LIMIT 选项(需要与BYSCORE或BYLEX组合使用)
379+
result1 = redisun.zrange(key, 1, 3, cmd -> cmd.sortByScore().limit(1, 2));
380380
Assert.assertEquals(2, result1.size());
381-
Assert.assertEquals("two", result1.get(0));
382-
Assert.assertEquals("three", result1.get(1));
381+
Assert.assertEquals("two", result1.get(0).getMember());
382+
Assert.assertEquals("three", result1.get(1).getMember());
383383

384384
// 清理测试数据
385385
redisun.del(key);

0 commit comments

Comments
 (0)