diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-27 14:32:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-27 14:32:50 +0000 |
commit | b37bc86e4cd8b19630ca7b30746faa8c7b78268c (patch) | |
tree | 839fefcbb03bc58bddc809bd45f8871599baac0d /test | |
parent | 8e130a56821db051fc6f9338e2175d65416c5798 (diff) | |
download | ruby-b37bc86e4cd8b19630ca7b30746faa8c7b78268c.tar.gz |
class.c: refine error messages
* class.c (rb_define_class, rb_define_class_id_under): refine
error messages.
* class.c (rb_define_module, rb_define_module_id_under): ditto,
and make consistent with class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_class.rb | 7 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 9c016dd693..1d9ee55d7a 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -547,5 +547,12 @@ class TestClass < Test::Unit::TestCase assert_raise_with_message(TypeError, "#{n} is not a class") { m.module_eval "class #{n}; end" } + + assert_separately([], <<-"end;") + Date = (class C\u{1f5ff}; self; end).new + assert_raise_with_message(TypeError, /C\u{1f5ff}/) { + require 'date' + } + end; end end diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index e04152f845..3d2d551a30 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -2103,6 +2103,13 @@ class TestModule < Test::Unit::TestCase assert_raise_with_message(TypeError, "#{n} is not a module") { m.module_eval "module #{n}; end" } + + assert_separately([], <<-"end;") + Etc = (class C\u{1f5ff}; self; end).new + assert_raise_with_message(TypeError, /C\u{1f5ff}/) { + require 'etc' + } + end; end private |