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:
parent
3ea61a2cf5
commit
c1b4b10a12
@ -317,9 +317,9 @@ num_sadded(VALUE x, VALUE name)
|
|||||||
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
|
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
|
||||||
rb_remove_method_id(rb_singleton_class(x), mid);
|
rb_remove_method_id(rb_singleton_class(x), mid);
|
||||||
rb_raise(rb_eTypeError,
|
rb_raise(rb_eTypeError,
|
||||||
"can't define singleton method \"%s\" for %s",
|
"can't define singleton method \"%"PRIsVALUE"\" for %"PRIsVALUE,
|
||||||
rb_id2name(mid),
|
rb_id2str(mid),
|
||||||
rb_obj_classname(x));
|
rb_obj_class(x));
|
||||||
|
|
||||||
UNREACHABLE;
|
UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,8 @@ class TestNumeric < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_numeric
|
def test_numeric
|
||||||
a = Numeric.new
|
a = Numeric.new
|
||||||
assert_raise(TypeError) { def a.foo; end }
|
assert_raise_with_message(TypeError, /foo/) { def a.foo; end }
|
||||||
assert_raise(TypeError) { eval("def a.\u3042; end") }
|
assert_raise_with_message(TypeError, /\u3042/) { eval("def a.\u3042; end") }
|
||||||
assert_raise(TypeError) { a.dup }
|
assert_raise(TypeError) { a.dup }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user