Bug #4371
closedassert_blockで ArgumentError が起きます
Description
=begin
昨日から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:inassert_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:inassert_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:inassert_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:inassert_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 Nakada nobu@ruby-lang.org
+
-
* test/fileutils/fileasserts.rb (Test::Unit::Assertions#assert_block):
-
show the given message.
Sat Feb 5 02:09:39 2011 Nobuyoshi Nakada nobu@ruby-lang.org
* 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
=end
Updated by kosaki (Motohiro KOSAKI) almost 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r30796.
Motohiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
msg can be passed nil. [Bug #4371] [ruby-dev:43174]
=end