Bug #4371: assert_blockで ArgumentError が起きます
http://redmine.ruby-lang.org/issues/show/4371
起票者: Motohiro KOSAKI
ステータス: Open, 優先度: Normal
Target version: 1.9.2
ruby -v: ruby 1.9.3dev (2011-01-18 trunk 30500) [x86_64-linux]
昨日からtrunkで4件エラーが増えました
-
Error:
test_cv_timed_wait(TestCV):
ArgumentError: assertion message must be String or Proc, but NilClass
was given.
/home/kosaki/linux/ruby-svn/ruby/test/fileutils/fileasserts.rb:12:in
assert_block' /home/kosaki/linux/ruby-svn/ruby/test/thread/test_cv.rb:113:in
test_cv_timed_wait’
./test/runner.rb:18:in `’ -
Error:
test_keys(TestEnv):
ArgumentError: assertion message must be String or Proc, but NilClass
was given.
/home/kosaki/linux/ruby-svn/ruby/test/fileutils/fileasserts.rb:12:in
assert_block' /home/kosaki/linux/ruby-svn/ruby/test/ruby/test_env.rb:140:in
test_keys’
./test/runner.rb:18:in `’ -
Error:
test_values(TestEnv):
ArgumentError: assertion message must be String or Proc, but NilClass
was given.
/home/kosaki/linux/ruby-svn/ruby/test/fileutils/fileasserts.rb:12:in
assert_block' /home/kosaki/linux/ruby-svn/ruby/test/ruby/test_env.rb:151:in
test_values’
./test/runner.rb:18:in `’ -
Error:
test_condvar_timed_wait(TestThread):
ArgumentError: assertion message must be String or Proc, but NilClass
was given.
/home/kosaki/linux/ruby-svn/ruby/test/fileutils/fileasserts.rb:12:in
assert_block' /home/kosaki/linux/ruby-svn/ruby/test/ruby/test_thread.rb:189:in
test_condvar_timed_wait’
./test/runner.rb:18:in `’
以下の変更で assert_blockがassertにnilを渡すのですが
commit f38aad8d878e5fbf760bf6ec71825a41d24e082e
Author: nobu nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Date: Fri Feb 4 18:34:12 2011 +0000
* test/fileutils/fileasserts.rb
(Test::Unit::Assertions#assert_block):
show the given message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30785
b2dd03c8-39d4-4d8f-98ff-823fe69b080e
diff --git a/ChangeLog b/ChangeLog
index 0f8b002…b01e63b 100644
— a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Feb 5 03:34:02 2011 Nobuyoshi N. [email protected]
+
-
* test/fileutils/fileasserts.rb
(Test::Unit::Assertions#assert_block):
-
show the given message.
Sat Feb 5 02:09:39 2011 Nobuyoshi N. [email protected]
* parse.y (lex_getline, parser_set_encode): set encoding of
lines
diff --git a/test/fileutils/fileasserts.rb
b/test/fileutils/fileasserts.rb
index bad87e9…579fefd 100644
— a/test/fileutils/fileasserts.rb
+++ b/test/fileutils/fileasserts.rb
@@ -8,6 +8,10 @@ module Test
yield
end
-
def assert_block msg = nil
-
assert yield, msg
-
end
assert側ではわざわざ引数チェックでnilを弾いている。ふむ
lib/test/unit/assertions.rb
def assert(test, msg = UNASSIGNED)
case msg
when UNASSIGNED
msg = nil
when String, Proc
else
bt = caller.reject { |s| s.rindex(MiniTest::MINI_DIR, 0) }
raise ArgumentError, "assertion message must be String or
Proc, but #{msg.class} was given.", bt
end
super
end