@@ -26,32 +26,26 @@ describe("The 'eval' method", function () {
26
26
} ) ;
27
27
28
28
it ( 'converts a float to an integer when evaluated' , function ( done ) {
29
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
30
29
client . eval ( "return 100.5" , 0 , helper . isNumber ( 100 , done ) ) ;
31
30
} ) ;
32
31
33
32
it ( 'returns a string' , function ( done ) {
34
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
35
33
client . eval ( "return 'hello world'" , 0 , helper . isString ( 'hello world' , done ) ) ;
36
34
} ) ;
37
35
38
36
it ( 'converts boolean true to integer 1' , function ( done ) {
39
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
40
37
client . eval ( "return true" , 0 , helper . isNumber ( 1 , done ) ) ;
41
38
} ) ;
42
39
43
40
it ( 'converts boolean false to null' , function ( done ) {
44
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
45
41
client . eval ( "return false" , 0 , helper . isNull ( done ) ) ;
46
42
} ) ;
47
43
48
44
it ( 'converts lua status code to string representation' , function ( done ) {
49
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
50
45
client . eval ( "return {ok='fine'}" , 0 , helper . isString ( 'fine' , done ) ) ;
51
46
} ) ;
52
47
53
48
it ( 'converts lua error to an error response' , function ( done ) {
54
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
55
49
client . eval ( "return {err='this is an error'}" , 0 , function ( err ) {
56
50
assert ( err . code === undefined ) ;
57
51
helper . isError ( ) ( err ) ;
@@ -60,7 +54,6 @@ describe("The 'eval' method", function () {
60
54
} ) ;
61
55
62
56
it ( 'represents a lua table appropritely' , function ( done ) {
63
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
64
57
client . eval ( "return {1,2,3,'ciao',{1,2}}" , 0 , function ( err , res ) {
65
58
assert . strictEqual ( 5 , res . length ) ;
66
59
assert . strictEqual ( 1 , res [ 0 ] ) ;
@@ -75,7 +68,6 @@ describe("The 'eval' method", function () {
75
68
} ) ;
76
69
77
70
it ( 'populates keys and argv correctly' , function ( done ) {
78
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
79
71
client . eval ( "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" , 2 , "a" , "b" , "c" , "d" , function ( err , res ) {
80
72
assert . strictEqual ( 4 , res . length ) ;
81
73
assert . strictEqual ( "a" , res [ 0 ] ) ;
@@ -87,7 +79,6 @@ describe("The 'eval' method", function () {
87
79
} ) ;
88
80
89
81
it ( 'allows arguments to be provided in array rather than as multiple parameters' , function ( done ) {
90
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
91
82
client . eval ( [ "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" , 2 , "a" , "b" , "c" , "d" ] , function ( err , res ) {
92
83
assert . strictEqual ( 4 , res . length ) ;
93
84
assert . strictEqual ( "a" , res [ 0 ] ) ;
@@ -99,7 +90,6 @@ describe("The 'eval' method", function () {
99
90
} ) ;
100
91
101
92
it ( 'allows a script to be executed that accesses the redis API without callback' , function ( done ) {
102
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
103
93
client . eval ( source , 0 ) ;
104
94
client . get ( 'sha' , helper . isString ( 'test' , done ) ) ;
105
95
} ) ;
@@ -108,24 +98,20 @@ describe("The 'eval' method", function () {
108
98
var sha = crypto . createHash ( 'sha1' ) . update ( source ) . digest ( 'hex' ) ;
109
99
110
100
it ( 'allows a script to be executed that accesses the redis API' , function ( done ) {
111
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
112
101
client . eval ( source , 0 , helper . isString ( 'OK' ) ) ;
113
102
client . get ( 'sha' , helper . isString ( 'test' , done ) ) ;
114
103
} ) ;
115
104
116
105
it ( 'can execute a script if the SHA exists' , function ( done ) {
117
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
118
106
client . evalsha ( sha , 0 , helper . isString ( 'OK' ) ) ;
119
107
client . get ( 'sha' , helper . isString ( 'test' , done ) ) ;
120
108
} ) ;
121
109
122
110
it ( 'returns an error if SHA does not exist' , function ( done ) {
123
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
124
111
client . evalsha ( 'ffffffffffffffffffffffffffffffffffffffff' , 0 , helper . isError ( done ) ) ;
125
112
} ) ;
126
113
127
114
it ( 'emit an error if SHA does not exist without any callback' , function ( done ) {
128
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
129
115
client . evalsha ( 'ffffffffffffffffffffffffffffffffffffffff' , 0 ) ;
130
116
client . on ( 'error' , function ( err ) {
131
117
assert . equal ( err . code , 'NOSCRIPT' ) ;
@@ -144,7 +130,6 @@ describe("The 'eval' method", function () {
144
130
} ) ;
145
131
146
132
it ( 'allows a key to be incremented, and performs appropriate conversion from LUA type' , function ( done ) {
147
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
148
133
client . set ( "incr key" , 0 , function ( err , reply ) {
149
134
if ( err ) return done ( err ) ;
150
135
client . eval ( "local foo = redis.call('incr','incr key')\n" + "return {type(foo),foo}" , 0 , function ( err , res ) {
@@ -157,7 +142,6 @@ describe("The 'eval' method", function () {
157
142
} ) ;
158
143
159
144
it ( 'allows a bulk operation to be performed, and performs appropriate conversion from LUA type' , function ( done ) {
160
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
161
145
client . set ( "bulk reply key" , "bulk reply value" , function ( err , res ) {
162
146
client . eval ( "local foo = redis.call('get','bulk reply key'); return {type(foo),foo}" , 0 , function ( err , res ) {
163
147
assert . strictEqual ( 2 , res . length ) ;
@@ -169,7 +153,6 @@ describe("The 'eval' method", function () {
169
153
} ) ;
170
154
171
155
it ( 'allows a multi mulk operation to be performed, with the appropriate type conversion' , function ( done ) {
172
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
173
156
client . multi ( )
174
157
. del ( "mylist" )
175
158
. rpush ( "mylist" , "a" )
@@ -190,7 +173,6 @@ describe("The 'eval' method", function () {
190
173
} ) ;
191
174
192
175
it ( 'returns an appropriate representation of Lua status reply' , function ( done ) {
193
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
194
176
client . eval ( "local foo = redis.call('set','mykey','myval'); return {type(foo),foo['ok']}" , 0 , function ( err , res ) {
195
177
assert . strictEqual ( 2 , res . length ) ;
196
178
assert . strictEqual ( "table" , res [ 0 ] ) ;
@@ -200,7 +182,6 @@ describe("The 'eval' method", function () {
200
182
} ) ;
201
183
202
184
it ( 'returns an appropriate representation of a Lua error reply' , function ( done ) {
203
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
204
185
client . set ( "error reply key" , "error reply value" , function ( err , res ) {
205
186
if ( err ) return done ( err ) ;
206
187
client . eval ( "local foo = redis.pcall('incr','error reply key'); return {type(foo),foo['err']}" , 0 , function ( err , res ) {
@@ -213,7 +194,6 @@ describe("The 'eval' method", function () {
213
194
} ) ;
214
195
215
196
it ( 'returns an appropriate representation of a Lua nil reply' , function ( done ) {
216
- helper . serverVersionAtLeast . call ( this , client , [ 2 , 5 , 0 ] ) ;
217
197
client . del ( "nil reply key" , function ( err , res ) {
218
198
if ( err ) return done ( err ) ;
219
199
client . eval ( "local foo = redis.call('get','nil reply key'); return {type(foo),foo == false}" , 0 , function ( err , res ) {
0 commit comments