зеркало из https://github.com/github/ruby.git
numeric.c: preserve encoding
* numeric.c (num_init_copy): preserve encoding of error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c1b4b10a12
Коммит
eb6575e137
|
@ -332,7 +332,7 @@ num_sadded(VALUE x, VALUE name)
|
|||
static VALUE
|
||||
num_init_copy(VALUE x, VALUE y)
|
||||
{
|
||||
rb_raise(rb_eTypeError, "can't copy %s", rb_obj_classname(x));
|
||||
rb_raise(rb_eTypeError, "can't copy %"PRIsVALUE, rb_obj_class(x));
|
||||
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
|
|
@ -56,11 +56,20 @@ class TestNumeric < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_numeric
|
||||
def test_singleton_method
|
||||
a = Numeric.new
|
||||
assert_raise_with_message(TypeError, /foo/) { def a.foo; end }
|
||||
assert_raise_with_message(TypeError, /\u3042/) { eval("def a.\u3042; end") }
|
||||
end
|
||||
|
||||
def test_dup
|
||||
a = Numeric.new
|
||||
assert_raise(TypeError) { a.dup }
|
||||
|
||||
c = Module.new do
|
||||
break eval("class C\u{3042} < Numeric; self; end")
|
||||
end
|
||||
assert_raise_with_message(TypeError, /C\u3042/) {c.new.dup}
|
||||
end
|
||||
|
||||
def test_quo
|
||||
|
|
Загрузка…
Ссылка в новой задаче