summaryrefslogtreecommitdiff
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-22 17:52:26 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-22 17:52:26 +0000
commit9f982bd59d6e3e5e4c2c5ca20bdef79df4f8b5c0 (patch)
tree39668290bde4b4a6382019150cc95248aef71c86 /test/ruby/test_module.rb
parent07ac36ada5a486023593d129b54be836923cfa4d (diff)
merge revision(s) r45874: [Backport #9813]
* class.c (rb_mod_init_copy): always clear instance variable, constant and method tables first, regardless the source tables. [ruby-dev:48182] [Bug #9813] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index ca453fa5eb..372a2d4ca5 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -375,6 +375,25 @@ class TestModule < Test::Unit::TestCase
assert_equal(:ok, Object.new.extend(m).foo, bug9535)
end
+ def test_initialize_copy_empty
+ bug9813 = '[ruby-dev:48182] [Bug #9813]'
+ m = Module.new do
+ def x
+ end
+ const_set(:X, 1)
+ @x = 2
+ end
+ assert_equal([:x], m.instance_methods)
+ assert_equal([:@x], m.instance_variables)
+ assert_equal([:X], m.constants)
+ m.module_eval do
+ initialize_copy(Module.new)
+ end
+ assert_empty(m.instance_methods, bug9813)
+ assert_empty(m.instance_variables, bug9813)
+ assert_empty(m.constants, bug9813)
+ end
+
def test_dup
bug6454 = '[ruby-core:45132]'