redis 3.0.0.rc2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,78 @@
1
+ # encoding: UTF-8
2
+
3
+ require "helper"
4
+
5
+ class TestScripting < Test::Unit::TestCase
6
+
7
+ include Helper::Client
8
+
9
+ def to_sha(script)
10
+ r.script(:load, script)
11
+ end
12
+
13
+ def test_script_exists
14
+ return if version < "2.5.9" # 2.6-rc1
15
+
16
+ a = to_sha("return 1")
17
+ b = a.succ
18
+
19
+ assert_equal true, r.script(:exists, a)
20
+ assert_equal false, r.script(:exists, b)
21
+ assert_equal [true], r.script(:exists, [a])
22
+ assert_equal [false], r.script(:exists, [b])
23
+ assert_equal [true, false], r.script(:exists, [a, b])
24
+ end
25
+
26
+ def test_script_flush
27
+ return if version < "2.5.9" # 2.6-rc1
28
+
29
+ sha = to_sha("return 1")
30
+ assert r.script(:exists, sha)
31
+ assert_equal "OK", r.script(:flush)
32
+ assert !r.script(:exists, sha)
33
+ end
34
+
35
+ def test_script_kill
36
+ return if version < "2.5.9" # 2.6-rc1
37
+
38
+ redis_mock(:script => lambda { |arg| "+#{arg.upcase}" }) do |redis|
39
+ assert_equal "KILL", redis.script(:kill)
40
+ end
41
+ end
42
+
43
+ def test_eval
44
+ return if version < "2.5.9" # 2.6-rc1
45
+
46
+ assert_equal 0, r.eval("return #KEYS")
47
+ assert_equal 0, r.eval("return #ARGV")
48
+ assert_equal ["k1", "k2"], r.eval("return KEYS", ["k1", "k2"])
49
+ assert_equal ["a1", "a2"], r.eval("return ARGV", [], ["a1", "a2"])
50
+ end
51
+
52
+ def test_eval_with_options_hash
53
+ return if version < "2.5.9" # 2.6-rc1
54
+
55
+ assert_equal 0, r.eval("return #KEYS", {})
56
+ assert_equal 0, r.eval("return #ARGV", {})
57
+ assert_equal ["k1", "k2"], r.eval("return KEYS", { :keys => ["k1", "k2"] })
58
+ assert_equal ["a1", "a2"], r.eval("return ARGV", { :argv => ["a1", "a2"] })
59
+ end
60
+
61
+ def test_evalsha
62
+ return if version < "2.5.9" # 2.6-rc1
63
+
64
+ assert_equal 0, r.evalsha(to_sha("return #KEYS"))
65
+ assert_equal 0, r.evalsha(to_sha("return #ARGV"))
66
+ assert_equal ["k1", "k2"], r.evalsha(to_sha("return KEYS"), ["k1", "k2"])
67
+ assert_equal ["a1", "a2"], r.evalsha(to_sha("return ARGV"), [], ["a1", "a2"])
68
+ end
69
+
70
+ def test_evalsha_with_options_hash
71
+ return if version < "2.5.9" # 2.6-rc1
72
+
73
+ assert_equal 0, r.evalsha(to_sha("return #KEYS"), {})
74
+ assert_equal 0, r.evalsha(to_sha("return #ARGV"), {})
75
+ assert_equal ["k1", "k2"], r.evalsha(to_sha("return KEYS"), { :keys => ["k1", "k2"] })
76
+ assert_equal ["a1", "a2"], r.evalsha(to_sha("return ARGV"), { :argv => ["a1", "a2"] })
77
+ end
78
+ end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc2
5
- prerelease: 6
4
+ version: 3.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ezra Zygmuntowicz
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2012-05-15 00:00:00.000000000 Z
20
+ date: 2012-05-23 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rake
@@ -45,6 +45,7 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - .gitignore
48
+ - .order
48
49
  - .travis.yml
49
50
  - .travis/Gemfile
50
51
  - .yardopts
@@ -104,6 +105,7 @@ files:
104
105
  - test/distributed_persistence_control_commands_test.rb
105
106
  - test/distributed_publish_subscribe_test.rb
106
107
  - test/distributed_remote_server_control_commands_test.rb
108
+ - test/distributed_scripting_test.rb
107
109
  - test/distributed_sorting_test.rb
108
110
  - test/distributed_test.rb
109
111
  - test/distributed_transactions_test.rb
@@ -123,6 +125,7 @@ files:
123
125
  - test/pipelining_commands_test.rb
124
126
  - test/publish_subscribe_test.rb
125
127
  - test/remote_server_control_commands_test.rb
128
+ - test/scripting_test.rb
126
129
  - test/sorting_test.rb
127
130
  - test/support/connection/hiredis.rb
128
131
  - test/support/connection/ruby.rb
@@ -151,15 +154,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
154
  required_rubygems_version: !ruby/object:Gem::Requirement
152
155
  none: false
153
156
  requirements:
154
- - - ! '>'
157
+ - - ! '>='
155
158
  - !ruby/object:Gem::Version
156
- version: 1.3.1
159
+ version: '0'
157
160
  requirements: []
158
161
  rubyforge_project:
159
- rubygems_version: 1.8.24
162
+ rubygems_version: 1.8.23
160
163
  signing_key:
161
164
  specification_version: 3
162
- summary: A Ruby client library for the Redis key-value store.
165
+ summary: A Ruby client library for Redis
163
166
  test_files:
164
167
  - test/blocking_commands_test.rb
165
168
  - test/command_map_test.rb
@@ -185,6 +188,7 @@ test_files:
185
188
  - test/distributed_persistence_control_commands_test.rb
186
189
  - test/distributed_publish_subscribe_test.rb
187
190
  - test/distributed_remote_server_control_commands_test.rb
191
+ - test/distributed_scripting_test.rb
188
192
  - test/distributed_sorting_test.rb
189
193
  - test/distributed_test.rb
190
194
  - test/distributed_transactions_test.rb
@@ -204,6 +208,7 @@ test_files:
204
208
  - test/pipelining_commands_test.rb
205
209
  - test/publish_subscribe_test.rb
206
210
  - test/remote_server_control_commands_test.rb
211
+ - test/scripting_test.rb
207
212
  - test/sorting_test.rb
208
213
  - test/support/connection/hiredis.rb
209
214
  - test/support/connection/ruby.rb
@@ -217,4 +222,3 @@ test_files:
217
222
  - test/transactions_test.rb
218
223
  - test/unknown_commands_test.rb
219
224
  - test/url_param_test.rb
220
- has_rdoc: