summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-11 16:42:43 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-11 16:42:43 +0000
commit8ab9a65791ccdf361f39a36292fe411c26683922 (patch)
tree05458a49bca6f08c47ac4c7f00a29c398c872678 /test
parentc5ce07eed74b9ea51a1ca47069efcf042a859e3c (diff)
merge revision(s) 40021,42380: [Backport #8686]
test_method.rb: split * test/ruby/test_method.rb (test_define_method): split for each tests. * object.c (rb_class_inherited_p): allow iclasses to be tested for inheritance. [Bug #8686] [ruby-core:56174] * test/ruby/test_method.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_method.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index 1935bf2ad8..6d0f6acf35 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -232,7 +232,9 @@ class TestMethod < Test::Unit::TestCase
assert_raise(TypeError) do
Class.new.class_eval { define_method(:bar, o.method(:bar)) }
end
+ end
+ def test_define_singleton_method
o = Object.new
def o.foo(c)
c.class_eval { define_method(:foo) }
@@ -252,7 +254,25 @@ class TestMethod < Test::Unit::TestCase
assert_raise(TypeError) do
Module.new.module_eval {define_method(:foo, Base.instance_method(:foo))}
end
+ end
+
+ def test_define_singleton_method_with_extended_method
+ bug8686 = "[ruby-core:56174]"
+
+ m = Module.new do
+ extend self
+
+ def a
+ "a"
+ end
+ end
+
+ assert_nothing_raised do
+ m.define_singleton_method(:a, m.method(:a))
+ end
+ end
+ def test_define_method_transplating
feature4254 = '[ruby-core:34267]'
m = Module.new {define_method(:meth, M.instance_method(:meth))}
assert_equal(:meth, Object.new.extend(m).meth, feature4254)