From 548b97e70c9115feaee8011a7b28c2a2f9660147 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 28 Jun 2015 17:10:26 +0000 Subject: [PATCH] insns.def: preserve encoding * insns.def (defineclass): preserve encoding of name in error messages for super class mismatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++++- insns.def | 4 ++-- test/ruby/test_class.rb | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4ed3c3a20..41cbbe87fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -Mon Jun 29 02:08:01 2015 Nobuyoshi Nakada +Mon Jun 29 02:10:10 2015 Nobuyoshi Nakada + + * insns.def (defineclass): preserve encoding of name in error + messages for super class mismatch. * insns.def (defineclass): preserve encoding of name in error messages for non-class super. diff --git a/insns.def b/insns.def index b983140fd8..f9ff0a4f74 100644 --- a/insns.def +++ b/insns.def @@ -869,8 +869,8 @@ defineclass tmp = rb_class_real(RCLASS_SUPER(klass)); if (tmp != super) { - rb_raise(rb_eTypeError, "superclass mismatch for class %s", - rb_id2name(id)); + rb_raise(rb_eTypeError, "superclass mismatch for class % "PRIsVALUE"", + rb_id2str(id)); } } } diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 27558e33dd..9c016dd693 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -369,6 +369,9 @@ class TestClass < Test::Unit::TestCase end end; } + assert_raise_with_message(TypeError, /#{n}/) { + m.module_eval "class #{n} < Class.new; end" + } end def test_cloned_singleton_method_added