Test::Unit::TestCase(1)
見よう見まね。
require "test/unit" class RubycoTest < Test::Unit::TestCase def test_rubyco testval = "Respected" assert_equal "Expected", testval, "Simple string test." end def test_rubycoadd z = 3 + 4 assert_equal 6, z, "Simple '+' test." end end
実行結果。
Loaded suite rubyco Started FF Finished in 0.04 seconds. 1) Failure: test_rubyco(RubycoTest) [rubyco.rb:6]: Simple string test. <"Expected"> expected but was <"Respected">. 2) Failure: test_rubycoadd(RubycoTest) [rubyco.rb:11]: Simple '+' test. <6> expected but was <7>. 2 tests, 2 assertions, 2 failures, 0 errors