зеркало из https://github.com/github/ruby.git
numeric.c: preserve encoding
* numeric.c (num_sadded): preserve encoding of error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3ea61a2cf5
Коммит
c1b4b10a12
|
@ -317,9 +317,9 @@ num_sadded(VALUE x, VALUE name)
|
|||
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
|
||||
rb_remove_method_id(rb_singleton_class(x), mid);
|
||||
rb_raise(rb_eTypeError,
|
||||
"can't define singleton method \"%s\" for %s",
|
||||
rb_id2name(mid),
|
||||
rb_obj_classname(x));
|
||||
"can't define singleton method \"%"PRIsVALUE"\" for %"PRIsVALUE,
|
||||
rb_id2str(mid),
|
||||
rb_obj_class(x));
|
||||
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
|
|
@ -58,8 +58,8 @@ class TestNumeric < Test::Unit::TestCase
|
|||
|
||||
def test_numeric
|
||||
a = Numeric.new
|
||||
assert_raise(TypeError) { def a.foo; end }
|
||||
assert_raise(TypeError) { eval("def a.\u3042; end") }
|
||||
assert_raise_with_message(TypeError, /foo/) { def a.foo; end }
|
||||
assert_raise_with_message(TypeError, /\u3042/) { eval("def a.\u3042; end") }
|
||||
assert_raise(TypeError) { a.dup }
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче