diff --git a/src/commands.jl b/src/commands.jl index 352ed05..d0c6100 100644 --- a/src/commands.jl +++ b/src/commands.jl @@ -212,8 +212,7 @@ end @redisfunction "watch" Bool key keys... # Scripting commands -# TODO: PipelineConnection and TransactionConnection -function evalscript(conn::RedisConnection, script, numkeys::Integer, keys, args) +function evalscript(conn::Union{RedisConnection,PipelineConnection,TransactionConnection}, script, numkeys::Integer, keys, args) response = execute_command(conn, flatten_command("eval", script, numkeys, keys, args)) return response end diff --git a/test/redis_tests.jl b/test/redis_tests.jl index 3431d65..0d99fe5 100644 --- a/test/redis_tests.jl +++ b/test/redis_tests.jl @@ -378,6 +378,8 @@ function redis_tests(conn = RedisConnection()) @test exec(trans) == ["OK", "foobar"] @test del(trans, testkey) == "QUEUED" @test exec(trans) == [true] + @test evalscript(trans, "return", 0, [], []) == "QUEUED" + @test exec(trans) == [nothing] disconnect(trans) end @@ -385,14 +387,21 @@ function redis_tests(conn = RedisConnection()) pipe = open_pipeline(conn) set(pipe, testkey3, "anything") @test length(read_pipeline(pipe)) == 1 + get(pipe, testkey3) set(pipe, testkey4, "testing") result = read_pipeline(pipe) @test length(result) == 2 @test result == ["anything", "OK"] + @test del(pipe, testkey3) == 1 @test del(pipe, testkey4) == 2 - @test result == ["anything", "OK"] + result = read_pipeline(pipe) + @test result == [1, 1] + + evalscript(pipe, "return", 0, [], []) + result = read_pipeline(pipe) + @test result == [] disconnect(pipe) end