aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_class.rb
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-10 16:07:06 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-10 16:07:06 +0000
commite3c25091cda672ff0ebe1dec996d859888907644 (patch)
tree84b40fdf51f069b14171d6a859627f0dbcc53bcd /test/ruby/test_class.rb
parentfec209551a1751de79b7f0257ae8533e1bdf3c7e (diff)
downloadruby-e3c25091cda672ff0ebe1dec996d859888907644.tar.gz
* iseq.c (rb_iseq_clone): sets local_iseq and klass properly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_class.rb')
-rw-r--r--test/ruby/test_class.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb
index 3a0ced8be7..c81f0752d4 100644
--- a/test/ruby/test_class.rb
+++ b/test/ruby/test_class.rb
@@ -220,4 +220,20 @@ class TestClass < Test::Unit::TestCase
assert_raise(SyntaxError) { eval("class C; return; end") }
assert_raise(SyntaxError) { eval("class C; yield; end") }
end
+
+ def test_clone
+ original = Class.new {
+ def foo
+ return super()
+ end
+ }
+ mod = Module.new {
+ def foo
+ return "mod#foo"
+ end
+ }
+ copy = original.clone
+ copy.send(:include, mod)
+ assert_equal("mod#foo", copy.new.foo)
+ end
end