ruby-changes:32532
From: nobu <ko1@a...>
Date: Wed, 15 Jan 2014 17:17:03 +0900 (JST)
Subject: [ruby-changes:32532] nobu:r44612 (trunk): numeric.c: preserve encoding
nobu 2014-01-15 17:16:40 +0900 (Wed, 15 Jan 2014) New Revision: 44612 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44612 Log: numeric.c: preserve encoding * numeric.c (num_sadded): preserve encoding of error message. Modified files: trunk/numeric.c trunk/test/ruby/test_numeric.rb Index: numeric.c =================================================================== --- numeric.c (revision 44611) +++ numeric.c (revision 44612) @@ -317,9 +317,9 @@ num_sadded(VALUE x, VALUE name) https://github.com/ruby/ruby/blob/trunk/numeric.c#L317 /* 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; } Index: test/ruby/test_numeric.rb =================================================================== --- test/ruby/test_numeric.rb (revision 44611) +++ test/ruby/test_numeric.rb (revision 44612) @@ -58,8 +58,8 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_numeric.rb#L58 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/