R
Richard
Hi,
I have a test suite that invokes on test set that specifies
assert_raise(ZeroDivisionError, MyCalc.new.calc)
When I run the test suite, instead of "1 test, 0 failures, 0 errors",
I get the following. The code follows this output.
What's up?
Richard
K:\_Projects\Ruby\TestUnitTesting\BasicTest>ruby MyCalcTest.rb
..\BasicCalc.rb:5:in `/': divided by 0 (ZeroDivisionError)
from .\BasicCalc.rb:5:in `calc'
from .\BasicCalc.rb:9
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from ./tc_TestSet.rb:1
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from MyCalcTest.rb:4
BasicCalc.rb
=========
# BasicCalc.rb
class MyCalc
def calc
2/0
end
end
tc_TestSet.rb
==========
require '.\BasicCalc.rb'
class Test1 < Test::Unit::TestCase # The long-winded way
def test_excep
assert_raise(ZeroDivisionError, MyCalc.new.calc)
end
end
MyCalcTest.rb
==========
# Reverse-Polish Evaluation Test
require 'test/unit'
require 'tc_TestSet'
I have a test suite that invokes on test set that specifies
assert_raise(ZeroDivisionError, MyCalc.new.calc)
When I run the test suite, instead of "1 test, 0 failures, 0 errors",
I get the following. The code follows this output.
What's up?
Richard
K:\_Projects\Ruby\TestUnitTesting\BasicTest>ruby MyCalcTest.rb
..\BasicCalc.rb:5:in `/': divided by 0 (ZeroDivisionError)
from .\BasicCalc.rb:5:in `calc'
from .\BasicCalc.rb:9
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from ./tc_TestSet.rb:1
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from
K:/_Utilities/Ruby_1.8.2-15/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from MyCalcTest.rb:4
BasicCalc.rb
=========
# BasicCalc.rb
class MyCalc
def calc
2/0
end
end
tc_TestSet.rb
==========
require '.\BasicCalc.rb'
class Test1 < Test::Unit::TestCase # The long-winded way
def test_excep
assert_raise(ZeroDivisionError, MyCalc.new.calc)
end
end
MyCalcTest.rb
==========
# Reverse-Polish Evaluation Test
require 'test/unit'
require 'tc_TestSet'