diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-05 12:36:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-05 12:36:45 +0000 |
commit | f113ab552c7f83bd12f4136bce7fb8ee89819adb (patch) | |
tree | c093b2d22bd3fec33646b12aea019edc820e1ea3 /test/ruby/test_module.rb | |
parent | 00a8203b0b31ba2063f4344418331af2dbed7db3 (diff) | |
download | ruby-f113ab552c7f83bd12f4136bce7fb8ee89819adb.tar.gz |
class.c: check redefinition
* class.c (rb_prepend_module): check redefinition of built-in opimized
methods. [ruby-dev:47124] [Bug #7983]
* vm.c (rb_vm_check_redefinition_by_prepend): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 6b9ac4416b..5450c8ff3a 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1475,6 +1475,20 @@ class TestModule < Test::Unit::TestCase end end + def test_prepend_optmethod + bug7983 = '[ruby-dev:47124] [Bug #7983]' + assert_separately [], %{ + module M + def /(other) + to_f / other + end + end + Fixnum.send(:prepend, M) + assert_equal(0.5, 1 / 2, "#{bug7983}") + } + assert_equal(0, 1 / 2) + end + def test_class_variables m = Module.new m.class_variable_set(:@@foo, 1) |