[Ruby 1.9-Bug#4371][Open] assert blockで ArgumentError が起きます

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件エラーが増えました

  1. 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:intest_cv_timed_wait’
    ./test/runner.rb:18:in `’

  2. 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:intest_keys’
    ./test/runner.rb:18:in `’

  3. 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:intest_values’
    ./test/runner.rb:18:in `’

  4. 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:intest_condvar_timed_wait’
    ./test/runner.rb:18:in `’

以下の変更で assert_blockがassertにnilを渡すのですが


commit f38aad8d878e5fbf760bf6ec71825a41d24e082e
Author: nobu [email protected]
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/[email protected] 

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

チケット #4371 が更新されました。 (by Motohiro KOSAKI)

ステータス OpenからClosedに変更
進捗 % 0から100に変更

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]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs