diff options
-rw-r--r-- | class.c | 4 | ||||
-rw-r--r-- | test/ruby/test_class.rb | 3 |
2 files changed, 5 insertions, 2 deletions
@@ -214,8 +214,8 @@ void rb_check_inheritable(VALUE super) { if (!RB_TYPE_P(super, T_CLASS)) { - rb_raise(rb_eTypeError, "superclass must be a Class (%s given)", - rb_obj_classname(super)); + rb_raise(rb_eTypeError, "superclass must be a Class (%"PRIsVALUE" given)", + rb_obj_class(super)); } if (RBASIC(super)->flags & FL_SINGLETON) { rb_raise(rb_eTypeError, "can't make subclass of singleton class"); diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 36aeaf2bdf..3508061840 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -193,6 +193,9 @@ class TestClass < Test::Unit::TestCase assert_raise(TypeError) { Class.new(c) } assert_raise(TypeError) { Class.new(Class) } assert_raise(TypeError) { eval("class Foo < Class; end") } + m = "M\u{1f5ff}" + o = Class.new {break eval("class #{m}; self; end.new")} + assert_raise_with_message(TypeError, /#{m}/) {Class.new(o)} end def test_initialize_copy |