Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests of new list methods; list methods return NULL if empty / non-existent #13

Merged
merged 5 commits into from Oct 4, 2015

Conversation

@russellpierce
Copy link
Contributor

@russellpierce russellpierce commented Oct 4, 2015

This PR:

  1. Adds tests for tests for lpush, rpush, lpop, and rpop
  2. Updates lpop and rpop such that if the list is empty or non-existent the return is NULL
  3. Updates lpush and rpush so they return the number of items in the list, consistent with the return from the redis server

My apologies for the piecemeal contribution and appreciation for @eddelbuettel 's patience and guidance.

…(length of list) for the value specified by redis.

Note: The current code may have a type inconsistency in that the native return from redis is an unsigned integer. However, because .Machine$integer.max is signed I don't coerce the response into an integer and instead allow it to return as a numeric. I'm not 100% of the sure of the consequences of this decision.
…e certainly are other behaviors possible, but this seems reasonably consistent with listLPop which on a non-existent key returns redis' (nil).
…t was returning 0 rather than the expected 1. Fixed and made the comment reflect the actual test.
eddelbuettel added a commit that referenced this pull request Oct 4, 2015
Tests of new list methods; list methods return NULL if empty / non-existent
@eddelbuettel eddelbuettel merged commit 462eedf into eddelbuettel:master Oct 4, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
eddelbuettel added a commit that referenced this pull request Oct 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.