2
0

basics.tcl 855 B

12345678910111213141516171819202122232425262728293031323334
  1. set testmodule [file normalize tests/modules/basics.so]
  2. start_server {tags {"modules"}} {
  3. r module load $testmodule
  4. test {test module api basics} {
  5. r test.basics
  6. } {ALL TESTS PASSED}
  7. test {test rm_call auto mode} {
  8. r hello 2
  9. set reply [r test.rmcallautomode]
  10. assert_equal [lindex $reply 0] f1
  11. assert_equal [lindex $reply 1] v1
  12. assert_equal [lindex $reply 2] f2
  13. assert_equal [lindex $reply 3] v2
  14. r hello 3
  15. set reply [r test.rmcallautomode]
  16. assert_equal [dict get $reply f1] v1
  17. assert_equal [dict get $reply f2] v2
  18. }
  19. test {test get resp} {
  20. r hello 2
  21. set reply [r test.getresp]
  22. assert_equal $reply 2
  23. r hello 3
  24. set reply [r test.getresp]
  25. assert_equal $reply 3
  26. }
  27. r module unload test
  28. }