Skip to content

Commit

Permalink
Add testcase for COMMAND command
Browse files Browse the repository at this point in the history
  • Loading branch information
liumiuyong committed May 10, 2021
1 parent d0bab0b commit 7554832
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/tcl/tests/test_helper.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ set ::all_tests {
unit/introspection
unit/limits
unit/geo
unit/command
integration/replication
}

Expand Down
33 changes: 33 additions & 0 deletions tests/tcl/tests/unit/command.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
start_server {tags {"command"}} {
test {COMMAND count} {
r command count
} {155}

test {COMMAND info} {
set e [lindex [r command info get mget] 0]
assert_equal [llength $e] 6
assert_equal [lindex $e 0] get
assert_equal [lindex $e 1] 2
assert_equal [lindex $e 2] {readonly}
assert_equal [lindex $e 3] 1
assert_equal [lindex $e 4] 1
assert_equal [lindex $e 5] 1
}

test {COMMAND} {
set e [lindex [r command] 16]
assert_equal [llength $e] 6
assert_equal [lindex $e 0] decr
assert_equal [lindex $e 1] 2
assert_equal [lindex $e 2] {write}
assert_equal [lindex $e 3] 1
assert_equal [lindex $e 4] 1
assert_equal [lindex $e 5] 1
}

test {COMMAND getkeys} {
assert_equal {test} [r command getkeys get test]
assert_equal {test test2} [r command getkeys mget test test2]
assert_equal {test} [r command getkeys zadd test 1 m1]
}
}

0 comments on commit 7554832

Please sign in to comment.