From fe994a4d043acf4bfa9d2a94bfbd691bb9556d4c Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 28 Jun 2015 16:35:58 +0000 Subject: test_redefinition_mismatch * test/ruby/test_{class,module}.rb (test_redefinition_mismatch): add tests of redefinition mismatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_class.rb | 8 ++++++++ test/ruby/test_module.rb | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 3508061840..efee102835 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -522,4 +522,12 @@ class TestClass < Test::Unit::TestCase assert_equal(m, m.xyzzy, "Bug #10871") } end + + def test_redefinition_mismatch + m = Module.new + m.module_eval "A = 1" + assert_raise_with_message(TypeError, /is not a class/) { + m.module_eval "class A; end" + } + end end diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index bdf699536d..e91d2c8a93 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -2066,6 +2066,14 @@ class TestModule < Test::Unit::TestCase end end + def test_redefinition_mismatch + m = Module.new + m.module_eval "A = 1" + assert_raise_with_message(TypeError, /is not a module/) { + m.module_eval "module A; end" + } + end + private def assert_top_method_is_private(method) -- cgit v1.2.3