зеркало из https://github.com/github/ruby.git
vm_insnhelper.c: preserve encodings
* vm_insnhelper.c (vm_search_super_method): preserve encodings of classes in message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c7ad29f58f
Коммит
2329a1a88d
|
@ -271,12 +271,12 @@ class TestSuper < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_super_in_instance_eval
|
||||
super_class = Class.new {
|
||||
super_class = EnvUtil.labeled_class("Super\u{30af 30e9 30b9}") {
|
||||
def foo
|
||||
return [:super, self]
|
||||
end
|
||||
}
|
||||
sub_class = Class.new(super_class) {
|
||||
sub_class = EnvUtil.labeled_class("Sub\u{30af 30e9 30b9}", super_class) {
|
||||
def foo
|
||||
x = Object.new
|
||||
x.instance_eval do
|
||||
|
@ -285,18 +285,18 @@ class TestSuper < Test::Unit::TestCase
|
|||
end
|
||||
}
|
||||
obj = sub_class.new
|
||||
assert_raise(TypeError) do
|
||||
assert_raise_with_message(TypeError, /Sub\u{30af 30e9 30b9}/) do
|
||||
obj.foo
|
||||
end
|
||||
end
|
||||
|
||||
def test_super_in_instance_eval_with_define_method
|
||||
super_class = Class.new {
|
||||
super_class = EnvUtil.labeled_class("Super\u{30af 30e9 30b9}") {
|
||||
def foo
|
||||
return [:super, self]
|
||||
end
|
||||
}
|
||||
sub_class = Class.new(super_class) {
|
||||
sub_class = EnvUtil.labeled_class("Sub\u{30af 30e9 30b9}", super_class) {
|
||||
define_method(:foo) do
|
||||
x = Object.new
|
||||
x.instance_eval do
|
||||
|
@ -305,18 +305,18 @@ class TestSuper < Test::Unit::TestCase
|
|||
end
|
||||
}
|
||||
obj = sub_class.new
|
||||
assert_raise(TypeError) do
|
||||
assert_raise_with_message(TypeError, /Sub\u{30af 30e9 30b9}/) do
|
||||
obj.foo
|
||||
end
|
||||
end
|
||||
|
||||
def test_super_in_orphan_block
|
||||
super_class = Class.new {
|
||||
super_class = EnvUtil.labeled_class("Super\u{30af 30e9 30b9}") {
|
||||
def foo
|
||||
return [:super, self]
|
||||
end
|
||||
}
|
||||
sub_class = Class.new(super_class) {
|
||||
sub_class = EnvUtil.labeled_class("Sub\u{30af 30e9 30b9}", super_class) {
|
||||
def foo
|
||||
lambda { super() }
|
||||
end
|
||||
|
@ -326,12 +326,12 @@ class TestSuper < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_super_in_orphan_block_with_instance_eval
|
||||
super_class = Class.new {
|
||||
super_class = EnvUtil.labeled_class("Super\u{30af 30e9 30b9}") {
|
||||
def foo
|
||||
return [:super, self]
|
||||
end
|
||||
}
|
||||
sub_class = Class.new(super_class) {
|
||||
sub_class = EnvUtil.labeled_class("Sub\u{30af 30e9 30b9}", super_class) {
|
||||
def foo
|
||||
x = Object.new
|
||||
x.instance_eval do
|
||||
|
@ -340,7 +340,7 @@ class TestSuper < Test::Unit::TestCase
|
|||
end
|
||||
}
|
||||
obj = sub_class.new
|
||||
assert_raise(TypeError) do
|
||||
assert_raise_with_message(TypeError, /Sub\u{30af 30e9 30b9}/) do
|
||||
obj.foo.call
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2041,8 +2041,8 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf
|
|||
|
||||
rb_raise(rb_eTypeError,
|
||||
"self has wrong type to call super in this context: "
|
||||
"%s (expected %s)",
|
||||
rb_obj_classname(ci->recv), rb_class2name(m));
|
||||
"%"PRIsVALUE" (expected %"PRIsVALUE")",
|
||||
rb_obj_class(ci->recv), m);
|
||||
}
|
||||
|
||||
switch (vm_search_superclass(GET_CFP(), iseq, sigval, ci)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче