mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 16:48:27 -05:00
aea6e71ef8
Without this fix, RM_ZsetRem can leave empty sorted sets which are not allowed to exist. Removing from a sorted set while iterating seems to work (while inserting causes failed assetions). RM_ZsetRangeEndReached is modified to return 1 if the key doesn't exist, to terminate iteration when the last element has been removed.
17 lines
477 B
Tcl
17 lines
477 B
Tcl
set testmodule [file normalize tests/modules/zset.so]
|
|
|
|
start_server {tags {"modules"}} {
|
|
r module load $testmodule
|
|
|
|
test {Module zset rem} {
|
|
r del k
|
|
r zadd k 100 hello 200 world
|
|
assert_equal 1 [r zset.rem k hello]
|
|
assert_equal 0 [r zset.rem k hello]
|
|
assert_equal 1 [r exists k]
|
|
# Check that removing the last element deletes the key
|
|
assert_equal 1 [r zset.rem k world]
|
|
assert_equal 0 [r exists k]
|
|
}
|
|
}
|