diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-11 05:40:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-11 05:40:52 +0000 |
commit | 2329a1a88dbbb5b1c9323d485cc95e30f7acbdf8 (patch) | |
tree | ff62ff3426770c35f602b3253a3b357abaa68a89 | |
parent | c7ad29f58ff8b740476fe4f902d9a033e4f521c9 (diff) | |
download | ruby-2329a1a88dbbb5b1c9323d485cc95e30f7acbdf8.tar.gz |
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
-rw-r--r-- | test/ruby/test_super.rb | 22 | ||||
-rw-r--r-- | vm_insnhelper.c | 4 |
2 files changed, 13 insertions, 13 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 9425cc83eb..fcf5773501 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -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 diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 1bca35ea22..8627701b3e 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -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)) { |