File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ def rpushx(key, value)
99
99
#
100
100
# @param [String] key
101
101
# @param [Integer] count number of elements to remove
102
- # @return [String, Array<String>] the values of the first elements
102
+ # @return [nil, String, Array<String>] the values of the first elements
103
103
def lpop ( key , count = nil )
104
104
command = [ :lpop , key ]
105
105
command << Integer ( count ) if count
@@ -110,7 +110,7 @@ def lpop(key, count = nil)
110
110
#
111
111
# @param [String] key
112
112
# @param [Integer] count number of elements to remove
113
- # @return [String, Array<String>] the values of the last elements
113
+ # @return [nil, String, Array<String>] the values of the last elements
114
114
def rpop ( key , count = nil )
115
115
command = [ :rpop , key ]
116
116
command << Integer ( count ) if count
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ def test_lpop
140
140
assert_equal 2 , r . llen ( "foo" )
141
141
assert_equal "s1" , r . lpop ( "foo" )
142
142
assert_equal 1 , r . llen ( "foo" )
143
+ assert_nil r . lpop ( "nonexistent" )
143
144
end
144
145
145
146
def test_lpop_count
@@ -160,6 +161,7 @@ def test_rpop
160
161
assert_equal 2 , r . llen ( "foo" )
161
162
assert_equal "s2" , r . rpop ( "foo" )
162
163
assert_equal 1 , r . llen ( "foo" )
164
+ assert_nil r . rpop ( "nonexistent" )
163
165
end
164
166
165
167
def test_rpop_count
You can’t perform that action at this time.
0 commit comments