redis 3.0.0.rc1 → 3.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +50 -0
- data/.travis/Gemfile +11 -0
- data/CHANGELOG.md +47 -19
- data/README.md +160 -149
- data/Rakefile +15 -50
- data/examples/pubsub.rb +1 -1
- data/examples/unicorn/config.ru +1 -1
- data/examples/unicorn/unicorn.rb +1 -1
- data/lib/redis.rb +790 -390
- data/lib/redis/client.rb +137 -49
- data/lib/redis/connection/hiredis.rb +26 -15
- data/lib/redis/connection/ruby.rb +170 -53
- data/lib/redis/connection/synchrony.rb +23 -35
- data/lib/redis/distributed.rb +92 -32
- data/lib/redis/errors.rb +4 -2
- data/lib/redis/pipeline.rb +17 -6
- data/lib/redis/version.rb +1 -1
- data/redis.gemspec +4 -6
- data/test/blocking_commands_test.rb +42 -0
- data/test/command_map_test.rb +18 -17
- data/test/commands_on_hashes_test.rb +13 -12
- data/test/commands_on_lists_test.rb +35 -45
- data/test/commands_on_sets_test.rb +55 -54
- data/test/commands_on_sorted_sets_test.rb +106 -105
- data/test/commands_on_strings_test.rb +64 -55
- data/test/commands_on_value_types_test.rb +66 -54
- data/test/connection_handling_test.rb +136 -151
- data/test/distributed_blocking_commands_test.rb +33 -40
- data/test/distributed_commands_on_hashes_test.rb +6 -7
- data/test/distributed_commands_on_lists_test.rb +13 -14
- data/test/distributed_commands_on_sets_test.rb +57 -58
- data/test/distributed_commands_on_sorted_sets_test.rb +11 -12
- data/test/distributed_commands_on_strings_test.rb +31 -32
- data/test/distributed_commands_on_value_types_test.rb +61 -46
- data/test/distributed_commands_requiring_clustering_test.rb +108 -108
- data/test/distributed_connection_handling_test.rb +14 -15
- data/test/distributed_internals_test.rb +7 -19
- data/test/distributed_key_tags_test.rb +36 -36
- data/test/distributed_persistence_control_commands_test.rb +17 -14
- data/test/distributed_publish_subscribe_test.rb +61 -69
- data/test/distributed_remote_server_control_commands_test.rb +39 -28
- data/test/distributed_sorting_test.rb +12 -13
- data/test/distributed_test.rb +40 -41
- data/test/distributed_transactions_test.rb +20 -21
- data/test/encoding_test.rb +12 -9
- data/test/error_replies_test.rb +42 -36
- data/test/helper.rb +118 -85
- data/test/helper_test.rb +20 -6
- data/test/internals_test.rb +167 -103
- data/test/lint/blocking_commands.rb +124 -0
- data/test/lint/hashes.rb +115 -93
- data/test/lint/lists.rb +86 -80
- data/test/lint/sets.rb +68 -62
- data/test/lint/sorted_sets.rb +200 -195
- data/test/lint/strings.rb +112 -94
- data/test/lint/value_types.rb +76 -55
- data/test/persistence_control_commands_test.rb +17 -12
- data/test/pipelining_commands_test.rb +135 -126
- data/test/publish_subscribe_test.rb +105 -110
- data/test/remote_server_control_commands_test.rb +74 -58
- data/test/sorting_test.rb +31 -29
- data/test/support/connection/hiredis.rb +1 -0
- data/test/support/connection/ruby.rb +1 -0
- data/test/support/connection/synchrony.rb +17 -0
- data/test/{redis_mock.rb → support/redis_mock.rb} +24 -21
- data/test/support/wire/synchrony.rb +24 -0
- data/test/support/wire/thread.rb +5 -0
- data/test/synchrony_driver.rb +9 -9
- data/test/test.conf +1 -1
- data/test/thread_safety_test.rb +21 -19
- data/test/transactions_test.rb +189 -118
- data/test/unknown_commands_test.rb +9 -8
- data/test/url_param_test.rb +46 -41
- metadata +28 -43
- data/TODO.md +0 -4
- data/benchmarking/thread_safety.rb +0 -38
- data/test/lint/internals.rb +0 -36
data/test/lint/sets.rb
CHANGED
@@ -1,90 +1,96 @@
|
|
1
|
-
|
2
|
-
assert true == r.sadd("foo", "s1")
|
3
|
-
assert true == r.sadd("foo", "s2")
|
4
|
-
assert false == r.sadd("foo", "s1")
|
1
|
+
module Lint
|
5
2
|
|
6
|
-
|
7
|
-
end
|
3
|
+
module Sets
|
8
4
|
|
9
|
-
|
10
|
-
|
5
|
+
def test_sadd
|
6
|
+
assert_equal true, r.sadd("foo", "s1")
|
7
|
+
assert_equal true, r.sadd("foo", "s2")
|
8
|
+
assert_equal false, r.sadd("foo", "s1")
|
11
9
|
|
12
|
-
|
13
|
-
|
10
|
+
assert_equal ["s1", "s2"], r.smembers("foo").sort
|
11
|
+
end
|
14
12
|
|
15
|
-
|
16
|
-
|
13
|
+
def test_variadic_sadd
|
14
|
+
return if version < "2.3.9" # 2.4-rc6
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
r.sadd("foo", "s2")
|
16
|
+
assert_equal 2, r.sadd("foo", ["s1", "s2"])
|
17
|
+
assert_equal 1, r.sadd("foo", ["s1", "s2", "s3"])
|
21
18
|
|
22
|
-
|
23
|
-
|
19
|
+
assert_equal ["s1", "s2", "s3"], r.smembers("foo").sort
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
22
|
+
def test_srem
|
23
|
+
r.sadd("foo", "s1")
|
24
|
+
r.sadd("foo", "s2")
|
27
25
|
|
28
|
-
|
29
|
-
|
26
|
+
assert_equal true, r.srem("foo", "s1")
|
27
|
+
assert_equal false, r.srem("foo", "s3")
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
r.sadd("foo", "s3")
|
29
|
+
assert_equal ["s2"], r.smembers("foo")
|
30
|
+
end
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
assert 1 == r.srem("foo", ["eee", "s3"])
|
32
|
+
def test_variadic_srem
|
33
|
+
return if version < "2.3.9" # 2.4-rc6
|
38
34
|
|
39
|
-
|
40
|
-
|
35
|
+
r.sadd("foo", "s1")
|
36
|
+
r.sadd("foo", "s2")
|
37
|
+
r.sadd("foo", "s3")
|
41
38
|
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
assert_equal 1, r.srem("foo", ["s1", "aaa"])
|
40
|
+
assert_equal 0, r.srem("foo", ["bbb", "ccc" "ddd"])
|
41
|
+
assert_equal 1, r.srem("foo", ["eee", "s3"])
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
assert nil == r.spop("foo")
|
49
|
-
end
|
43
|
+
assert_equal ["s2"], r.smembers("foo")
|
44
|
+
end
|
50
45
|
|
51
|
-
|
52
|
-
|
46
|
+
def test_spop
|
47
|
+
r.sadd "foo", "s1"
|
48
|
+
r.sadd "foo", "s2"
|
53
49
|
|
54
|
-
|
50
|
+
assert ["s1", "s2"].include?(r.spop("foo"))
|
51
|
+
assert ["s1", "s2"].include?(r.spop("foo"))
|
52
|
+
assert_equal nil, r.spop("foo")
|
53
|
+
end
|
55
54
|
|
56
|
-
|
55
|
+
def test_scard
|
56
|
+
assert_equal 0, r.scard("foo")
|
57
57
|
|
58
|
-
|
58
|
+
r.sadd "foo", "s1"
|
59
59
|
|
60
|
-
|
61
|
-
end
|
60
|
+
assert_equal 1, r.scard("foo")
|
62
61
|
|
63
|
-
|
64
|
-
assert false == r.sismember("foo", "s1")
|
62
|
+
r.sadd "foo", "s2"
|
65
63
|
|
66
|
-
|
64
|
+
assert_equal 2, r.scard("foo")
|
65
|
+
end
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
end
|
67
|
+
def test_sismember
|
68
|
+
assert_equal false, r.sismember("foo", "s1")
|
71
69
|
|
72
|
-
|
73
|
-
assert [] == r.smembers("foo")
|
70
|
+
r.sadd "foo", "s1"
|
74
71
|
|
75
|
-
r.
|
76
|
-
|
72
|
+
assert_equal true, r.sismember("foo", "s1")
|
73
|
+
assert_equal false, r.sismember("foo", "s2")
|
74
|
+
end
|
77
75
|
|
78
|
-
|
79
|
-
|
76
|
+
def test_smembers
|
77
|
+
assert_equal [], r.smembers("foo")
|
80
78
|
|
81
|
-
|
82
|
-
|
83
|
-
r.sadd "foo", "s2"
|
79
|
+
r.sadd "foo", "s1"
|
80
|
+
r.sadd "foo", "s2"
|
84
81
|
|
85
|
-
|
86
|
-
|
87
|
-
end
|
82
|
+
assert_equal ["s1", "s2"], r.smembers("foo").sort
|
83
|
+
end
|
88
84
|
|
89
|
-
|
85
|
+
def test_srandmember
|
86
|
+
r.sadd "foo", "s1"
|
87
|
+
r.sadd "foo", "s2"
|
88
|
+
|
89
|
+
4.times do
|
90
|
+
assert ["s1", "s2"].include?(r.srandmember("foo"))
|
91
|
+
end
|
92
|
+
|
93
|
+
assert_equal 2, r.scard("foo")
|
94
|
+
end
|
95
|
+
end
|
90
96
|
end
|
data/test/lint/sorted_sets.rb
CHANGED
@@ -1,196 +1,201 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
1
|
+
module Lint
|
2
|
+
|
3
|
+
module SortedSets
|
4
|
+
|
5
|
+
def test_zadd
|
6
|
+
assert_equal 0, r.zcard("foo")
|
7
|
+
assert_equal true, r.zadd("foo", 1, "s1")
|
8
|
+
assert_equal false, r.zadd("foo", 1, "s1")
|
9
|
+
assert_equal 1, r.zcard("foo")
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_variadic_zadd
|
13
|
+
return if version < "2.3.9" # 2.4-rc6
|
14
|
+
|
15
|
+
# Non-nested array with pairs
|
16
|
+
assert_equal 0, r.zcard("foo")
|
17
|
+
assert_equal 2, r.zadd("foo", [1, "s1", 2, "s2"])
|
18
|
+
assert_equal 1, r.zadd("foo", [4, "s1", 5, "s2", 6, "s3"])
|
19
|
+
assert_equal 3, r.zcard("foo")
|
20
|
+
r.del "foo"
|
21
|
+
|
22
|
+
# Nested array with pairs
|
23
|
+
assert_equal 0, r.zcard("foo")
|
24
|
+
assert_equal 2, r.zadd("foo", [[1, "s1"], [2, "s2"]])
|
25
|
+
assert_equal 1, r.zadd("foo", [[4, "s1"], [5, "s2"], [6, "s3"]])
|
26
|
+
assert_equal 3, r.zcard("foo")
|
27
|
+
r.del "foo"
|
28
|
+
|
29
|
+
# Wrong number of arguments
|
30
|
+
assert_raise(Redis::CommandError) { r.zadd("foo", ["bar"]) }
|
31
|
+
assert_raise(Redis::CommandError) { r.zadd("foo", ["bar", "qux", "zap"]) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_zrem
|
35
|
+
r.zadd("foo", 1, "s1")
|
36
|
+
r.zadd("foo", 2, "s2")
|
37
|
+
|
38
|
+
assert_equal 2, r.zcard("foo")
|
39
|
+
assert_equal true, r.zrem("foo", "s1")
|
40
|
+
assert_equal false, r.zrem("foo", "s1")
|
41
|
+
assert_equal 1, r.zcard("foo")
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_variadic_zrem
|
45
|
+
return if version < "2.3.9" # 2.4-rc6
|
46
|
+
|
47
|
+
r.zadd("foo", 1, "s1")
|
48
|
+
r.zadd("foo", 2, "s2")
|
49
|
+
r.zadd("foo", 3, "s3")
|
50
|
+
|
51
|
+
assert_equal 3, r.zcard("foo")
|
52
|
+
assert_equal 1, r.zrem("foo", ["s1", "aaa"])
|
53
|
+
assert_equal 0, r.zrem("foo", ["bbb", "ccc" "ddd"])
|
54
|
+
assert_equal 1, r.zrem("foo", ["eee", "s3"])
|
55
|
+
assert_equal 1, r.zcard("foo")
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_zincrby
|
59
|
+
rv = r.zincrby "foo", 1, "s1"
|
60
|
+
assert_equal 1.0, rv
|
61
|
+
|
62
|
+
rv = r.zincrby "foo", 10, "s1"
|
63
|
+
assert_equal 11.0, rv
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_zrank
|
67
|
+
r.zadd "foo", 1, "s1"
|
68
|
+
r.zadd "foo", 2, "s2"
|
69
|
+
r.zadd "foo", 3, "s3"
|
70
|
+
|
71
|
+
assert_equal 2, r.zrank("foo", "s3")
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_zrevrank
|
75
|
+
r.zadd "foo", 1, "s1"
|
76
|
+
r.zadd "foo", 2, "s2"
|
77
|
+
r.zadd "foo", 3, "s3"
|
78
|
+
|
79
|
+
assert_equal 0, r.zrevrank("foo", "s3")
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_zrange
|
83
|
+
r.zadd "foo", 1, "s1"
|
84
|
+
r.zadd "foo", 2, "s2"
|
85
|
+
r.zadd "foo", 3, "s3"
|
86
|
+
|
87
|
+
assert_equal ["s1", "s2"], r.zrange("foo", 0, 1)
|
88
|
+
assert_equal [["s1", 1.0], ["s2", 2.0]], r.zrange("foo", 0, 1, :with_scores => true)
|
89
|
+
assert_equal [["s1", 1.0], ["s2", 2.0]], r.zrange("foo", 0, 1, :withscores => true)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_zrevrange
|
93
|
+
r.zadd "foo", 1, "s1"
|
94
|
+
r.zadd "foo", 2, "s2"
|
95
|
+
r.zadd "foo", 3, "s3"
|
96
|
+
|
97
|
+
assert_equal ["s3", "s2"], r.zrevrange("foo", 0, 1)
|
98
|
+
assert_equal [["s3", 3.0], ["s2", 2.0]], r.zrevrange("foo", 0, 1, :with_scores => true)
|
99
|
+
assert_equal [["s3", 3.0], ["s2", 2.0]], r.zrevrange("foo", 0, 1, :withscores => true)
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_zrangebyscore
|
103
|
+
r.zadd "foo", 1, "s1"
|
104
|
+
r.zadd "foo", 2, "s2"
|
105
|
+
r.zadd "foo", 3, "s3"
|
106
|
+
|
107
|
+
assert_equal ["s2", "s3"], r.zrangebyscore("foo", 2, 3)
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_zrevrangebyscore
|
111
|
+
r.zadd "foo", 1, "s1"
|
112
|
+
r.zadd "foo", 2, "s2"
|
113
|
+
r.zadd "foo", 3, "s3"
|
114
|
+
|
115
|
+
assert_equal ["s3", "s2"], r.zrevrangebyscore("foo", 3, 2)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_zrangebyscore_with_limit
|
119
|
+
r.zadd "foo", 1, "s1"
|
120
|
+
r.zadd "foo", 2, "s2"
|
121
|
+
r.zadd "foo", 3, "s3"
|
122
|
+
r.zadd "foo", 4, "s4"
|
123
|
+
|
124
|
+
assert_equal ["s2"], r.zrangebyscore("foo", 2, 4, :limit => [0, 1])
|
125
|
+
assert_equal ["s3"], r.zrangebyscore("foo", 2, 4, :limit => [1, 1])
|
126
|
+
assert_equal ["s3", "s4"], r.zrangebyscore("foo", 2, 4, :limit => [1, 2])
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_zrevrangebyscore_with_limit
|
130
|
+
r.zadd "foo", 1, "s1"
|
131
|
+
r.zadd "foo", 2, "s2"
|
132
|
+
r.zadd "foo", 3, "s3"
|
133
|
+
r.zadd "foo", 4, "s4"
|
134
|
+
|
135
|
+
assert_equal ["s4"], r.zrevrangebyscore("foo", 4, 2, :limit => [0, 1])
|
136
|
+
assert_equal ["s3"], r.zrevrangebyscore("foo", 4, 2, :limit => [1, 1])
|
137
|
+
assert_equal ["s3", "s2"], r.zrevrangebyscore("foo", 4, 2, :limit => [1, 2])
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_zrangebyscore_with_withscores
|
141
|
+
r.zadd "foo", 1, "s1"
|
142
|
+
r.zadd "foo", 2, "s2"
|
143
|
+
r.zadd "foo", 3, "s3"
|
144
|
+
r.zadd "foo", 4, "s4"
|
145
|
+
|
146
|
+
assert_equal [["s2", 2.0]], r.zrangebyscore("foo", 2, 4, :limit => [0, 1], :with_scores => true)
|
147
|
+
assert_equal [["s3", 3.0]], r.zrangebyscore("foo", 2, 4, :limit => [1, 1], :with_scores => true)
|
148
|
+
assert_equal [["s2", 2.0]], r.zrangebyscore("foo", 2, 4, :limit => [0, 1], :withscores => true)
|
149
|
+
assert_equal [["s3", 3.0]], r.zrangebyscore("foo", 2, 4, :limit => [1, 1], :withscores => true)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_zrevrangebyscore_with_withscores
|
153
|
+
r.zadd "foo", 1, "s1"
|
154
|
+
r.zadd "foo", 2, "s2"
|
155
|
+
r.zadd "foo", 3, "s3"
|
156
|
+
r.zadd "foo", 4, "s4"
|
157
|
+
|
158
|
+
assert_equal [["s4", 4.0]], r.zrevrangebyscore("foo", 4, 2, :limit => [0, 1], :with_scores => true)
|
159
|
+
assert_equal [["s3", 3.0]], r.zrevrangebyscore("foo", 4, 2, :limit => [1, 1], :with_scores => true)
|
160
|
+
assert_equal [["s4", 4.0]], r.zrevrangebyscore("foo", 4, 2, :limit => [0, 1], :withscores => true)
|
161
|
+
assert_equal [["s3", 3.0]], r.zrevrangebyscore("foo", 4, 2, :limit => [1, 1], :withscores => true)
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_zcard
|
165
|
+
assert_equal 0, r.zcard("foo")
|
166
|
+
|
167
|
+
r.zadd "foo", 1, "s1"
|
168
|
+
|
169
|
+
assert_equal 1, r.zcard("foo")
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_zscore
|
173
|
+
r.zadd "foo", 1, "s1"
|
174
|
+
|
175
|
+
assert_equal 1.0, r.zscore("foo", "s1")
|
176
|
+
|
177
|
+
assert_equal nil, r.zscore("foo", "s2")
|
178
|
+
assert_equal nil, r.zscore("bar", "s1")
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_zremrangebyrank
|
182
|
+
r.zadd "foo", 10, "s1"
|
183
|
+
r.zadd "foo", 20, "s2"
|
184
|
+
r.zadd "foo", 30, "s3"
|
185
|
+
r.zadd "foo", 40, "s4"
|
186
|
+
|
187
|
+
assert_equal 3, r.zremrangebyrank("foo", 1, 3)
|
188
|
+
assert_equal ["s1"], r.zrange("foo", 0, -1)
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_zremrangebyscore
|
192
|
+
r.zadd "foo", 1, "s1"
|
193
|
+
r.zadd "foo", 2, "s2"
|
194
|
+
r.zadd "foo", 3, "s3"
|
195
|
+
r.zadd "foo", 4, "s4"
|
196
|
+
|
197
|
+
assert_equal 3, r.zremrangebyscore("foo", 2, 4)
|
198
|
+
assert_equal ["s1"], r.zrange("foo", 0, -1)
|
199
|
+
end
|
200
|
+
end
|
196
201
|
end
|