diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-07 04:09:51 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-07 04:09:51 +0000 |
commit | 5836962f48200c71f5989315b9e2ac4db2b87541 (patch) | |
tree | 0bfbe67f67e006879dc95fd4c76f7a8b57b24975 /test | |
parent | 1c5104ac9c0803c476b54d751b0ec4579a1828af (diff) | |
download | ruby-5836962f48200c71f5989315b9e2ac4db2b87541.tar.gz |
* eval.c (rb_mod_refine): set RMODULE_IS_REFINEMENT to a created
refinement module, and don't override method_added.
* vm_method.c (rb_method_entry_make): check redefinition of
optimized methods when a method is added to a refinement module.
[ruby-core:48970] [Bug #7290]
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_refinement.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 20542d6492..aeb519c18d 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -191,6 +191,18 @@ class TestRefinement < Test::Unit::TestCase assert_equal(0, 1 / 2) end + def test_override_builtin_method_with_method_added + m = Module.new { + refine Fixnum do + def self.method_added(*args); end + def +(other) "overriden" end + end + } + assert_equal(3, 1 + 2) + assert_equal("overriden", m.module_eval { 1 + 2 }) + assert_equal(3, 1 + 2) + end + def test_return_value_of_refine mod = nil result = nil |