2
0

subcommands.tcl 862 B

12345678910111213141516171819
  1. set testmodule [file normalize tests/modules/subcommands.so]
  2. start_server {tags {"modules"}} {
  3. r module load $testmodule
  4. test "Module subcommands via COMMAND" {
  5. set reply [r command info subcommands.bitarray]
  6. set subcmds [lindex [lindex $reply 0] 8]
  7. assert_equal [lsort $subcmds] {{get -2 {} 1 1 1 {} {{flags read begin_search {type index spec {index 1}} find_keys {type range spec {lastkey 0 keystep 1 limit 0}}}} {}} {set -2 {} 1 1 1 {} {{flags write begin_search {type index spec {index 1}} find_keys {type range spec {lastkey 0 keystep 1 limit 0}}}} {}}}
  8. }
  9. test "Module pure-container command fails on arity error" {
  10. catch {r subcommands.bitarray} e
  11. assert_match {*wrong number of arguments*} $e
  12. # Subcommands can be called
  13. assert_equal [r subcommands.bitarray get k1] {OK}
  14. }
  15. }