6

我正在使用 Ruby 1.9.2(ruby -v 产生:ruby 1.9.2p290(2011-07-09 修订版 32553)[x86_64-linux]),我试图让它工作:

require 'test/unit'

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

当我运行它时,我得到

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


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

我很难找到有关此功能的文档,除了关于 SO 等的零散帖子。

是的,我想使用此功能而不是设置。

TIA

4

2 回答 2

2

Ruby 1.9.x 捆绑了 minitest 而不是 Test::Unit。Ruby 1.8.x 中捆绑的 Test::Unit 尚未改进,但未捆绑的 Test::Unit (test-unit 2) 将积极改进。

所以你必须使用 Test::Unit gem?它可能是不支持此功能的旧版本吗?

于 2011-10-03T19:32:28.857 回答
2

Ruby 1.9.2 默认使用 Minitest 而不是 Test::Unit,因此 Minitest 可能缺少此功能。

于 2011-10-03T19:38:47.087 回答