Sha256: a7750d319e9f05cde983e75ef92e16f95e711df58248051cd559ecc75c69c4e4
Contents?: true
Size: 1.01 KB
Versions: 14
Compression:
Stored size: 1.01 KB
Contents
#!/usr/bin/env ruby # Unit test for trepan.interface.user require 'test/unit' require_relative '../../interface/user' # Tests Trepan::UserInterface class TestInterfaceUser < Test::Unit::TestCase # Test UserInterface.confirm() def test_confirm user_intf = Trepan::UserInterface.new def user_intf.readline(prompt) $response_answer end ['y', 'Y', 'Yes', ' YES '].each do |s| $response_answer = s ans = user_intf.confirm('Testing', true) assert_equal(true, ans) end ['n', 'N', 'No', ' NO '].each do |s| $response_answer = s ans = user_intf.confirm('Testing', true) assert_equal(false, ans) end def user_intf.readline(prompt) raise EOFError end [true, false].each do |tf| assert_equal(tf, user_intf.confirm('default testing', tf)) end # Ok, we'll throw in one test of EOFError assert_raises EOFError do user_intf.readline('') end end # FIXME: more thorough testing of other routines in user. end
Version data entries
14 entries across 14 versions & 1 rubygems