* lib/test/unit.rb (Test::Unit::RequireFiles#non_options): skip

test suites failed to load instead of mere messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-02-13 10:41:59 +00:00
Родитель 0224758a7a
Коммит 63ca916ed4
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sun Feb 13 19:41:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit.rb (Test::Unit::RequireFiles#non_options): skip
test suites failed to load instead of mere messages.
Sun Feb 13 09:56:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/openssl/test_config.rb (OpenSSL#test_freeze): fix error

Просмотреть файл

@ -166,6 +166,9 @@ module Test
end
module RequireFiles
path = File.expand_path('../../rubygems/custom_require.rb', __FILE__)
CUSTOM_REQUIRE = /\A#{Regexp.quote(path)}:\d+:in `require'\z/ #'
def non_options(files, options)
return false if !super
result = false
@ -177,8 +180,17 @@ module Test
begin
require path
result = true
rescue LoadError
puts "#{f}: #{$!}"
rescue LoadError => e
Class.new(Test::Unit::TestCase) do
message = e.message
/ -- (?<failed>.*)/ =~ message
define_singleton_method(:to_s) {failed}
backtrace = e.backtrace
backtrace.shift while CUSTOM_REQUIRE =~ backtrace.first
/(?<file>.*):(?<line>\d+):in\s`/ =~ backtrace.first
line = line.to_i
define_method(:test_require_failed) {eval "skip(message)", nil, file, line}
end
end
}
result