alicebob / miniredis

Pure Go Redis server for Go unittests
MIT License
3.1k stars 217 forks source link

Return empty array for SRANDMEMBER on nonexistent key #376

Closed WKBae closed 6 months ago

WKBae commented 6 months ago

https://redis.io/docs/latest/commands/srandmember/ SRANDMEMBER with count returns an empty array if the key does not exist. Updated the implementation and added test for this case.

alicebob commented 6 months ago

thanks! I'll also add a test in ./integration/. Or you can do that, doesn't matter :)

WKBae commented 6 months ago

Didn't seem hard, I've added a commit. The former integration test that probably meant SRANDMEMBER nosuch seems to ran SPOP. It is also corrected in the commit.

alicebob commented 6 months ago

Thanks! Merged, will make it a new release in a few days.