test_rfc1143.rb 653 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. require 'atto'
  2. include Atto::Test
  3. require_relative '../lib/rfc1143'
  4. include Telnet::Codes
  5. assert { RFC1143 }
  6. sm = RFC1143.new(:echo, :no, :no, true)
  7. assert { sm }
  8. assert { sm.telopt == :echo }
  9. assert { sm.us == :no }
  10. assert { sm.him == :no }
  11. assert { sm.agree == true }
  12. assert do
  13. sm = RFC1143.new(:echo, :no, :no, true)
  14. res, arg = sm.handle_will
  15. res == TELNET_DO
  16. arg == :echo
  17. end
  18. assert do
  19. sm = RFC1143.new(:echo, :no, :no, false)
  20. res, arg = sm.handle_will
  21. res == TELNET_DONT
  22. arg == :echo
  23. end
  24. assert do
  25. sm = RFC1143.new(:echo, :no, :no, false)
  26. res, arg = sm.send_will
  27. res == TELNET_WILL
  28. arg == :echo
  29. end