mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
9d64a54209
commit
ce7f8287e2
3 changed files with 20 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Sat Oct 31 10:22:49 2015 yui-knk <spiketeika@gmail.com>
|
||||||
|
|
||||||
|
* 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]
|
||||||
|
|
||||||
Fri Oct 30 21:12:45 2015 Kazuki Tsujimoto <kazuki@callcc.net>
|
Fri Oct 30 21:12:45 2015 Kazuki Tsujimoto <kazuki@callcc.net>
|
||||||
|
|
||||||
* gems/bundled_gems: update to power_assert 0.2.5.
|
* gems/bundled_gems: update to power_assert 0.2.5.
|
||||||
|
|
|
@ -208,7 +208,7 @@ ruby_error_print(void)
|
||||||
error_print();
|
error_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%$s'")
|
#define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'")
|
||||||
#define undef_mesg(v) ( \
|
#define undef_mesg(v) ( \
|
||||||
is_mod ? \
|
is_mod ? \
|
||||||
undef_mesg_for(v, "module") : \
|
undef_mesg_for(v, "module") : \
|
||||||
|
|
|
@ -721,4 +721,16 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
||||||
assert_raise(NameError) {a.instance_eval("foo")}
|
assert_raise(NameError) {a.instance_eval("foo")}
|
||||||
assert_raise(NoMethodError, bug10969) {a.public_send("bar", true)}
|
assert_raise(NoMethodError, bug10969) {a.public_send("bar", true)}
|
||||||
end
|
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 `#<Module:.*>'\z/, error.message
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue