can't get test unit startup to work in ruby 1.9.2

自古美人都是妖i 提交于 2019-12-21 15:03:31

问题


I am using Ruby 1.9.2 (ruby -v yields :ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]), and I am trying to get this to work:

require 'test/unit'

class TestStartup < Test::Unit::TestCase
  def self.startup
    puts "startup"
  end
  def test1
    puts "in test1"
  end
end 

when I run it, I get

Loaded suite test_startup
Started
in test1
.
Finished in 0.000395 seconds. 


1 tests, 0 assertions, 0 failures, 0 errors, 0 skips

I had a hard time finding documentation on this feature, other than scattered posts here on SO and the like.

And yes, I want to use this feature and not setup.

TIA


回答1:


Ruby 1.9.x bundles minitest not Test::Unit. Test::Unit bundled in Ruby 1.8.x had not been improved but unbundled Test::Unit (test-unit 2) will be improved actively.

So you must be using the Test::Unit gem? Is it perhaps an older version which doesn't support this feature?




回答2:


Ruby 1.9.2 uses Minitest instead of Test::Unit by default, so it might be that this feature is missing from Minitest.



来源:https://stackoverflow.com/questions/7639582/cant-get-test-unit-startup-to-work-in-ruby-1-9-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!