[前][次][番号順一覧][スレッド一覧]

ruby-changes:33485

From: nobu <ko1@a...>
Date: Fri, 11 Apr 2014 14:40:59 +0900 (JST)
Subject: [ruby-changes:33485] nobu:r45564 (trunk): vm_insnhelper.c: preserve encodings

nobu	2014-04-11 14:40:52 +0900 (Fri, 11 Apr 2014)

  New Revision: 45564

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45564

  Log:
    vm_insnhelper.c: preserve encodings
    
    * vm_insnhelper.c (vm_search_super_method): preserve encodings of
      classes in message.

  Modified files:
    trunk/test/ruby/test_super.rb
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 45563)
+++ vm_insnhelper.c	(revision 45564)
@@ -2041,8 +2041,8 @@ vm_search_super_method(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2041
 
 	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)) {
Index: test/ruby/test_super.rb
===================================================================
--- test/ruby/test_super.rb	(revision 45563)
+++ test/ruby/test_super.rb	(revision 45564)
@@ -271,12 +271,12 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_super.rb#L271
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_super.rb#L285
       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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_super.rb#L305
       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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_super.rb#L326
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_super.rb#L340
       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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]