From 9c00f078978e452d541ddc8a9a2b7704db2cb7f3 Mon Sep 17 00:00:00 2001 From: antirez Date: Sat, 17 Nov 2012 11:17:54 +0100 Subject: [PATCH] Test: MULTI/EXEC tests moved into multi.tcl. --- tests/test_helper.tcl | 2 +- tests/unit/{cas.tcl => multi.tcl} | 49 ++++++++++++++++++++++++++++++- tests/unit/other.tcl | 47 ----------------------------- 3 files changed, 49 insertions(+), 49 deletions(-) rename tests/unit/{cas.tcl => multi.tcl} (74%) diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index a376b8bb..b2e58b44 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -24,7 +24,7 @@ set ::all_tests { unit/sort unit/expire unit/other - unit/cas + unit/multi unit/quit unit/aofrw integration/replication diff --git a/tests/unit/cas.tcl b/tests/unit/multi.tcl similarity index 74% rename from tests/unit/cas.tcl rename to tests/unit/multi.tcl index 95766abe..9069b95b 100644 --- a/tests/unit/cas.tcl +++ b/tests/unit/multi.tcl @@ -1,4 +1,51 @@ -start_server {tags {"cas"}} { +start_server {tags {"multi"}} { + test {MUTLI / EXEC basics} { + r del mylist + r rpush mylist a + r rpush mylist b + r rpush mylist c + r multi + set v1 [r lrange mylist 0 -1] + set v2 [r ping] + set v3 [r exec] + list $v1 $v2 $v3 + } {QUEUED QUEUED {{a b c} PONG}} + + test {DISCARD} { + r del mylist + r rpush mylist a + r rpush mylist b + r rpush mylist c + r multi + set v1 [r del mylist] + set v2 [r discard] + set v3 [r lrange mylist 0 -1] + list $v1 $v2 $v3 + } {QUEUED OK {a b c}} + + test {Nested MULTI are not allowed} { + set err {} + r multi + catch {[r multi]} err + r exec + set _ $err + } {*ERR MULTI*} + + test {MULTI where commands alter argc/argv} { + r sadd myset a + r multi + r spop myset + list [r exec] [r exists myset] + } {a 0} + + test {WATCH inside MULTI is not allowed} { + set err {} + r multi + catch {[r watch x]} err + r exec + set _ $err + } {*ERR WATCH*} + test {EXEC works on WATCHed key not modified} { r watch x y z r watch k diff --git a/tests/unit/other.tcl b/tests/unit/other.tcl index 14fd73ac..a53f3f5c 100644 --- a/tests/unit/other.tcl +++ b/tests/unit/other.tcl @@ -193,53 +193,6 @@ start_server {tags {"other"}} { } {1} } - test {MUTLI / EXEC basics} { - r del mylist - r rpush mylist a - r rpush mylist b - r rpush mylist c - r multi - set v1 [r lrange mylist 0 -1] - set v2 [r ping] - set v3 [r exec] - list $v1 $v2 $v3 - } {QUEUED QUEUED {{a b c} PONG}} - - test {DISCARD} { - r del mylist - r rpush mylist a - r rpush mylist b - r rpush mylist c - r multi - set v1 [r del mylist] - set v2 [r discard] - set v3 [r lrange mylist 0 -1] - list $v1 $v2 $v3 - } {QUEUED OK {a b c}} - - test {Nested MULTI are not allowed} { - set err {} - r multi - catch {[r multi]} err - r exec - set _ $err - } {*ERR MULTI*} - - test {MULTI where commands alter argc/argv} { - r sadd myset a - r multi - r spop myset - list [r exec] [r exists myset] - } {a 0} - - test {WATCH inside MULTI is not allowed} { - set err {} - r multi - catch {[r watch x]} err - r exec - set _ $err - } {*ERR WATCH*} - test {APPEND basics} { list [r append foo bar] [r get foo] \ [r append foo 100] [r get foo] -- 2.47.2