2
0

getkeys.tcl 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. set testmodule [file normalize tests/modules/getkeys.so]
  2. start_server {tags {"modules"}} {
  3. r module load $testmodule
  4. test {COMMAND INFO correctly reports a movable keys module command} {
  5. set info [lindex [r command info getkeys.command] 0]
  6. assert_equal {movablekeys} [lindex $info 2]
  7. assert_equal {0} [lindex $info 3]
  8. assert_equal {0} [lindex $info 4]
  9. assert_equal {0} [lindex $info 5]
  10. }
  11. test {COMMAND GETKEYS correctly reports a movable keys module command} {
  12. r command getkeys getkeys.command arg1 arg2 key key1 arg3 key key2 key key3
  13. } {key1 key2 key3}
  14. test {RM_GetCommandKeys on non-existing command} {
  15. catch {r getkeys.introspect non-command key1 key2} e
  16. set _ $e
  17. } {*ENOENT*}
  18. test {RM_GetCommandKeys on built-in fixed keys command} {
  19. r getkeys.introspect set key1 value1
  20. } {key1}
  21. test {RM_GetCommandKeys on EVAL} {
  22. r getkeys.introspect eval "" 4 key1 key2 key3 key4 arg1 arg2
  23. } {key1 key2 key3 key4}
  24. test {RM_GetCommandKeys on a movable keys module command} {
  25. r getkeys.introspect getkeys.command arg1 arg2 key key1 arg3 key key2 key key3
  26. } {key1 key2 key3}
  27. test {RM_GetCommandKeys on a non-movable module command} {
  28. r getkeys.introspect getkeys.fixed arg1 key1 key2 key3 arg2
  29. } {key1 key2 key3}
  30. test {RM_GetCommandKeys with bad arity} {
  31. catch {r getkeys.introspect set key} e
  32. set _ $e
  33. } {*EINVAL*}
  34. }