diff --git a/numeric.c b/numeric.c index c207fbf521..3ceb5ae2d2 100644 --- a/numeric.c +++ b/numeric.c @@ -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; } diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb index fc4f39a91d..7fbb8e955d 100644 --- a/test/ruby/test_numeric.rb +++ b/test/ruby/test_numeric.rb @@ -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