From fb9c1db7cd67bc70d10d49c3fdb4b5569091f513 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 31 Oct 2015 01:22:51 +0000 Subject: 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index f8ddd9d3fa..d0ed477916 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -721,4 +721,16 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| assert_raise(NameError) {a.instance_eval("foo")} assert_raise(NoMethodError, bug10969) {a.public_send("bar", true)} end + + 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 `#'\z/, error.message + end end -- cgit v1.2.3