Permalink
Browse files

Test: MULTI/EXEC tests moved into multi.tcl.

  • Loading branch information...
1 parent 3d13912 commit 9c00f078978e452d541ddc8a9a2b7704db2cb7f3 @antirez committed Nov 17, 2012
Showing with 49 additions and 49 deletions.
  1. +1 −1 tests/test_helper.tcl
  2. +48 −1 tests/unit/{cas.tcl → multi.tcl}
  3. +0 −47 tests/unit/other.tcl
View
@@ -24,7 +24,7 @@ set ::all_tests {
unit/sort
unit/expire
unit/other
- unit/cas
+ unit/multi
unit/quit
unit/aofrw
integration/replication
@@ -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
View
@@ -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]

0 comments on commit 9c00f07

Please sign in to comment.