1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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:
nobu 2014-01-15 08:16:40 +00:00
parent 3ea61a2cf5
commit c1b4b10a12
2 changed files with 5 additions and 5 deletions

View file

@ -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;
}

View file

@ -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