alicebob / miniredis

Pure Go Redis server for Go unittests
MIT License
3.09k stars 215 forks source link

Return empty array for SRANDMEMBER on nonexistent key #376

Closed WKBae closed 5 months ago

WKBae commented 5 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 5 months ago

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

WKBae commented 5 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 5 months ago

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