summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 09:58:45 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 09:58:45 +0000
commitd848edb1d5ee68896950e9b5fe3e57badfdfb680 (patch)
tree386790e0b609ad8c4b14ca8a6c9d40e3104bf040 /test
parentdedbe778faa8c7a5de321412e30588ff162fb34a (diff)
merge revision(s) 45874: [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_0_0@46519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 c6979d8393..c8e25bad0f 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -320,6 +320,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]'