Project

General

Profile

Bug #11640

[PATHC] Sometime `NameError#message` raises `ArgumentError: malformed format string - %$`

Added by yui-knk (Kaneko Yuichiro) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-10-30 trunk 52371) [x86_64-darwin14]
[ruby-core:71282]

Description

  def test_message_of_name_error
    begin
      Module.new do
        module_function :foo
      end
    rescue => e
      error = e
    end

    assert_match /\Aundefined method `foo' for module `#<Module:.*>'\z/, error.message
  end

# =>

TestException#test_name_error:
ArgumentError: malformed format string - %$
    /Users/yuichirokaneko/ruby/ruby/test/ruby/test_exception.rb:734:in `to_str'
    /Users/yuichirokaneko/ruby/ruby/test/ruby/test_exception.rb:734:in `to_s'
    /Users/yuichirokaneko/ruby/ruby/test/ruby/test_exception.rb:734:in `message'
    /Users/yuichirokaneko/ruby/ruby/test/ruby/test_exception.rb:734:in `test_name_error'

I send PR.

Also available in: Atom PDF