Project

General

Profile

Bug #4371

assert_blockで ArgumentError が起きます

Added by kosaki (Motohiro KOSAKI) almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2011-01-18 trunk 30500) [x86_64-linux]
Backport:
[ruby-dev:43174]

Description

=begin
昨日からtrunkで4件エラーが増えました

2) 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 `'

3) 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 `'

4) 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 `'

7) 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 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

Associated revisions

Revision 49f8799a
Added by kosaki (Motohiro KOSAKI) almost 9 years ago

  • lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): msg can be passed nil. [Bug #4371] [ruby-dev:43174]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 30796
Added by kosaki (Motohiro KOSAKI) almost 9 years ago

  • lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): msg can be passed nil. [Bug #4371] [ruby-dev:43174]

Revision 30796
Added by kosaki (Motohiro KOSAKI) almost 9 years ago

  • lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): msg can be passed nil. [Bug #4371] [ruby-dev:43174]

Revision 30796
Added by kosaki (Motohiro KOSAKI) almost 9 years ago

  • lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): msg can be passed nil. [Bug #4371] [ruby-dev:43174]

Revision 30796
Added by kosaki (Motohiro KOSAKI) almost 9 years ago

  • lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): msg can be passed nil. [Bug #4371] [ruby-dev:43174]

Revision 30796
Added by kosaki (Motohiro KOSAKI) almost 9 years ago

  • lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): msg can be passed nil. [Bug #4371] [ruby-dev:43174]

Revision 30796
Added by kosaki (Motohiro KOSAKI) almost 9 years ago

  • lib/test/unit/assertions.rb (Test::Unit::Assertions#assert): msg can be passed nil. [Bug #4371] [ruby-dev:43174]

History

#1

Updated by kosaki (Motohiro KOSAKI) almost 9 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

Also available in: Atom PDF