Fix key extraction for SORT

We only want to use the last STORE key, but we have to record
we actually found a STORE key so we can increment the final return
key count.

Test added to prevent further regression.

Closes #1883, #1645, #1647
This commit is contained in:
Matt Stancliff
2014-07-21 17:31:21 -04:00
committed by antirez
parent b7a4cfb4b3
commit 14cedd4279
2 changed files with 11 additions and 2 deletions

View File

@ -95,6 +95,14 @@ start_server {
assert_encoding ziplist sort-res
}
test "SORT extracts STORE correctly" {
r command getkeys sort abc store def
} {abc def}
test "SORT extracts multiple STORE correctly" {
r command getkeys sort abc store invalid store stillbad store def
} {abc def}
test "SORT DESC" {
assert_equal [lsort -decreasing -integer $result] [r sort tosort DESC]
}