@@ -169,40 +169,45 @@ func TestScript(t *testing.T) {
169169 "SCRIPT" , "FOO" ,
170170 proto .Error ("ERR unknown subcommand 'FOO'. Try SCRIPT HELP." ),
171171 )
172- }
173172
174- func TestCJSON (t * testing.T ) {
175- _ , c := runWithClient (t )
173+ t .Run ("CJSON" , func (t * testing.T ) {
174+ mustDo (t , c ,
175+ "EVAL" , `return cjson.decode('{"id":"foo"}')['id']` , "0" ,
176+ proto .String ("foo" ),
177+ )
178+ mustDo (t , c ,
179+ "EVAL" , `return cjson.encode({foo=42})` , "0" ,
180+ proto .String (`{"foo":42}` ),
181+ )
176182
177- mustDo (t , c ,
178- "EVAL" , `return cjson.decode('{"id":"foo"}')['id']` , "0" ,
179- proto .String ("foo" ),
180- )
181- mustDo (t , c ,
182- "EVAL" , `return cjson.encode({foo=42})` , "0" ,
183- proto .String (`{"foo":42}` ),
184- )
183+ mustContain (t , c ,
184+ "EVAL" , `redis.encode()` , "0" ,
185+ "Error compiling script" ,
186+ )
187+ mustContain (t , c ,
188+ "EVAL" , `redis.encode("1", "2")` , "0" ,
189+ "Error compiling script" ,
190+ )
191+ mustContain (t , c ,
192+ "EVAL" , `redis.decode()` , "0" ,
193+ "Error compiling script" ,
194+ )
195+ mustContain (t , c ,
196+ "EVAL" , `redis.decode("{")` , "0" ,
197+ "Error compiling script" ,
198+ )
199+ mustContain (t , c ,
200+ "EVAL" , `redis.decode("1", "2")` , "0" ,
201+ "Error compiling script" ,
202+ )
203+ })
185204
186- mustContain (t , c ,
187- "EVAL" , `redis.encode()` , "0" ,
188- "Error compiling script" ,
189- )
190- mustContain (t , c ,
191- "EVAL" , `redis.encode("1", "2")` , "0" ,
192- "Error compiling script" ,
193- )
194- mustContain (t , c ,
195- "EVAL" , `redis.decode()` , "0" ,
196- "Error compiling script" ,
197- )
198- mustContain (t , c ,
199- "EVAL" , `redis.decode("{")` , "0" ,
200- "Error compiling script" ,
201- )
202- mustContain (t , c ,
203- "EVAL" , `redis.decode("1", "2")` , "0" ,
204- "Error compiling script" ,
205- )
205+ t .Run ("os." , func (t * testing.T ) {
206+ mustDo (t , c ,
207+ "EVAL" , `return os.clock()` , "0" ,
208+ proto .Int (42 ),
209+ )
210+ })
206211}
207212
208213func TestLog (t * testing.T ) {
0 commit comments