1

以下产生错误:

require 'test/unit'

Test::Unit.setup_argv(["tests"])

$ run_tests.rb:4: undefined method `setup_argv' for Test::Unit:Module (NoMethodError)

如何让 Ruby 使用Test::Unit类而不是Test::Unit模块进行方法调用?

编辑红宝石 1.8.7

4

1 回答 1

2

错误的原因是 setup_argv 在 Ruby 1.8.7 中不可用。
Test::Unit 始终是一个模块。没有课。

有关如何使用,请参阅此处的 1.8.7 文档:http:
//apidock.com/ruby/v1_8_7_330/Test/Unit

于 2011-07-02T00:38:27.177 回答