summaryrefslogtreecommitdiff
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-14 05:35:21 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-14 05:35:21 +0000
commita28d1eff6534328cae5363bbf0cc26cd0a18b948 (patch)
tree846b20ae8ec12c856eca10bcf108f00646e0fd16 /test/ruby/test_module.rb
parentd551b78d4ad27c1c9a4026d11896d4630a1ffed8 (diff)
* proc.c (rb_mod_define_method): now they return the symbols of the
defined methods, not the methods/procs themselves. [ruby-dev:42151] [Feature #3753] * NEWS: documents about above change and def-expr (see r42337). * test/ruby/test_module.rb: tests about above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index b0a33c8609..1124101664 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1749,6 +1749,26 @@ class TestModule < Test::Unit::TestCase
RUBY
end
+ def test_return_value_of_define_method
+ retvals = []
+ Class.new.class_eval do
+ retvals << define_method(:foo){}
+ retvals << define_method(:bar, instance_method(:foo))
+ end
+ assert_equal :foo, retvals[0]
+ assert_equal :bar, retvals[1]
+ end
+
+ def test_return_value_of_define_singleton_method
+ retvals = []
+ Class.new do
+ retvals << define_singleton_method(:foo){}
+ retvals << define_singleton_method(:bar, method(:foo))
+ end
+ assert_equal :foo, retvals[0]
+ assert_equal :bar, retvals[1]
+ end
+
private
def assert_top_method_is_private(method)