1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-06-28 16:35:58 +00:00
parent da70f4d02a
commit fe994a4d04
2 changed files with 16 additions and 0 deletions

View file

@ -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

View file

@ -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)