(use redis-client socket) (socket-receive-timeout 3000) (define (test a b) (pp a) (if (procedure? b) (b a) (if (not (equal? a b)) (if (not (get-environment-variable "SALMONELLA_RUNNING")) (error (sprintf "Failed test: ~S != ~S" a b)))))) (redis-connect "127.0.0.1" 6379) (test (redis-echo "Hello, World!") '("Hello, World!")) (test (redis-write-command (*redis-out-port*) "ECHO" (list "Hello, World!")) (lambda(x)#t)) (test (redis-read-response (*redis-in-port*)) '("Hello, World!")) (test (redis-subscribe "test-channel") '("subscribe" "test-channel" 1)) (test (redis-unsubscribe "test-channel") '("unsubscribe" "test-channel" 0)) (test (redis-flushall) '("OK")) (test (redis-ping) '("PONG")) (test (redis-lpush "scheme-test" "1234") '(1)) (test (redis-rpop "scheme-test") '("1234")) (test (redis-rpush "scheme-test" "abc") '(1)) (test (redis-lpop "scheme-test") '("abc")) (test (redis-publish "channel" "hello") '(0)) (test (redis-set "key1" "value1") '("OK")) (test (redis-get "key1") '("value1")) (test (redis-type "key1") '("string")) (test (redis-append "key1" "!!!") '(9)) (test (redis-get "key1") '("value1!!!")) (test (redis-ttl "key1") '(-1)) (test (redis-expire "key1" "100") '(1)) (test (redis-ttl "key1") '(100)) (test (redis-keys "key*") '("key1")) (test (redis-exists "key1") '(1)) (test (redis-strlen "key1") '(9)) (test (redis-del "key1") '(1)) (test (redis-set "key2" "1") '("OK")) (test (redis-incr "key2") '(2)) (test (redis-incrby "key2" "2") '(4)) (test (redis-decr "key2") '(3)) (test (redis-decrby "key2" "2") '(1)) (test (redis-del "key2") '(1)) (test (redis-echo "Hello") '("Hello")) (test (redis-hset "hash1" "key" "val") '(1)) (test (redis-hget "hash1" "key") '("val")) (test (redis-hget "hash1" "nokey") '(())) (test (redis-hgetall "hash1") '("key" "val")) (test (redis-hexists "hash1" "key") '(1)) (test (redis-hkeys "hash1") '("key")) (test (redis-hlen "hash1") '(1)) (test (redis-blpop "list1" "1") '()) (test (redis-quit) '("OK"))