Project

General

Profile

Actions

Bug #11640

closed

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

Added by yui-knk (Kaneko Yuichiro) about 9 years ago. Updated about 9 years ago.

Status:
Closed
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.

Actions #1

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Open to Closed

Applied in changeset r52400.


eval_error.c: Fix a format of NameError#message

  • eval_error.c (undef_mesg_for): fix typo. Before this commit
    ArgumentError: malformed format string - %$ was raised when
    NameError#message is called. [ruby-core:71282] [Bug #11640]
    [Fix GH-1077]
Actions

Also available in: Atom PDF

Like0
Like0