From 7ac6d4613f3552ec17b4ccc6b4493ae9250e3fd2 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 28 Apr 2009 16:21:16 +0200 Subject: [PATCH] GETSET tests --- client-libraries/tcl/redis.tcl | 2 +- test-redis.tcl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client-libraries/tcl/redis.tcl b/client-libraries/tcl/redis.tcl index 6890bfb64..d1ec72861 100644 --- a/client-libraries/tcl/redis.tcl +++ b/client-libraries/tcl/redis.tcl @@ -19,7 +19,7 @@ array set ::redis::bulkarg {} # Flag commands requiring last argument as a bulk write operation foreach redis_bulk_cmd { - set setnx rpush lpush lset lrem sadd srem sismember echo + set setnx rpush lpush lset lrem sadd srem sismember echo getset } { set ::redis::bulkarg($redis_bulk_cmd) {} } diff --git a/test-redis.tcl b/test-redis.tcl index 63df9764a..3bfd5a1e1 100644 --- a/test-redis.tcl +++ b/test-redis.tcl @@ -646,6 +646,15 @@ proc main {server port} { $r randomkey } {} + test {GETSET (set new value)} { + list [$r getset foo xyz] [$r get foo] + } {{} xyz} + + test {GETSET (replace old value)} { + $r set foo bar + list [$r getset foo xyz] [$r get foo] + } {bar xyz} + # Leave the user with a clean DB before to exit test {FLUSHALL} { $r flushall