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)
9999 #
100100 # @param [String] key
101101 # @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
103103 def lpop ( key , count = nil )
104104 command = [ :lpop , key ]
105105 command << Integer ( count ) if count
@@ -110,7 +110,7 @@ def lpop(key, count = nil)
110110 #
111111 # @param [String] key
112112 # @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
114114 def rpop ( key , count = nil )
115115 command = [ :rpop , key ]
116116 command << Integer ( count ) if count
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ def test_lpop
140140 assert_equal 2 , r . llen ( "foo" )
141141 assert_equal "s1" , r . lpop ( "foo" )
142142 assert_equal 1 , r . llen ( "foo" )
143+ assert_nil r . lpop ( "nonexistent" )
143144 end
144145
145146 def test_lpop_count
@@ -160,6 +161,7 @@ def test_rpop
160161 assert_equal 2 , r . llen ( "foo" )
161162 assert_equal "s2" , r . rpop ( "foo" )
162163 assert_equal 1 , r . llen ( "foo" )
164+ assert_nil r . rpop ( "nonexistent" )
163165 end
164166
165167 def test_rpop_count
You can’t perform that action at this time.
0 commit comments