sds / mock_redis

Mock Redis gem for Ruby
Other
492 stars 154 forks source link

zrange doesn't support BYSCORE #307

Open floriandejonckheere opened 3 months ago

floriandejonckheere commented 3 months ago

Starting with Redis 6.2.0, the ZRANGE command with BYSCORE argument replaces the ZRANGEBYSCORE command. However, in this implementation the ZRANGE command ignores the argument and only respects the index-based range query.

real_redis.zadd 'zset', 60, 'message0'
 => true 
real_redis.zadd 'zset', 61, 'message1'
 => true 
real_redis.zrange 'zset', 0, 1, byscore: true, with_scores: true
 => [] 

mock_redis.zadd 'zset', 60, 'message0'
 => true
mock_redis.zadd 'zset', 61, 'message1'
 => true 
mock_redis.zrange 'zset', 0, 1, byscore: true, with_scores: true
 => [["message0", 60.0], ["message1", 61.0]]
mock_redis.zrangebyscore 'zset', 0, 1, with_scores: true
=> []