diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-12 15:03:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-12 15:03:02 +0000 |
commit | d7feab06ccaacff4e673f22e55a9b8f537fa89ba (patch) | |
tree | feaacfbcd5bc13c8509c59b914d084ae19b14b30 /test/ruby/test_module.rb | |
parent | 797749c21938b27098d758a2d837b42996c0c310 (diff) | |
download | ruby-d7feab06ccaacff4e673f22e55a9b8f537fa89ba.tar.gz |
* vm_method.c (rb_add_method, rb_add_method_me): call method added
hook after definition. [ruby-core:25536]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index c001c5507c..23fce969dd 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -755,4 +755,23 @@ class TestModule < Test::Unit::TestCase c = eval("class C\u{df}; self; end") assert_equal("TestModule::C\u{df}", c.name, '[ruby-core:24600]') end + + def test_method_added + memo = [] + mod = Module.new do + mod = self + (class << self ; self ; end).class_eval do + define_method :method_added do |sym| + memo << sym + memo << mod.instance_methods(false) + memo << (mod.instance_method(sym) rescue nil) + end + end + def f + end + end + assert_equal :f, memo.shift + assert_equal mod.instance_methods(false), memo.shift + assert_equal mod.instance_method(:f), memo.shift + end end |