diff options
author | John Hawthorn <[email protected]> | 2024-11-26 16:40:47 -0800 |
---|---|---|
committer | John Hawthorn <[email protected]> | 2024-11-29 20:41:00 -0800 |
commit | f1dda5ed011b79d0d7bd31b09b55b5e19d8abd0c (patch) | |
tree | c041fbb7590bbb9414aab605e00d0c6e570946c8 /test/ruby | |
parent | a505cd32fb55aec0423c5b57d17ae31c076b44ab (diff) |
Warn when redefining __id__ as well as object_id
[Feature #20912]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12177
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_module.rb | 2 | ||||
-rw-r--r-- | test/ruby/test_object.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 73d33d8602..4c171bb439 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1488,7 +1488,7 @@ class TestModule < Test::Unit::TestCase class << o; self; end.instance_eval { undef_method(:foo) } end - %w(object_id __send__ initialize).each do |n| + %w(object_id __id__ __send__ initialize).each do |n| assert_in_out_err([], <<-INPUT, [], %r"warning: undefining '#{n}' may cause serious problems$") $VERBOSE = false Class.new.instance_eval { undef_method(:#{n}) } diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 3afad0ef43..7d00422629 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -480,7 +480,7 @@ class TestObject < Test::Unit::TestCase end def test_redefine_method_which_may_case_serious_problem - %w(object_id __send__).each do |m| + %w(object_id __id__ __send__).each do |m| assert_in_out_err([], <<-INPUT, [], %r"warning: redefining '#{m}' may cause serious problems$") $VERBOSE = false def (Object.new).#{m}; end @@ -542,7 +542,7 @@ class TestObject < Test::Unit::TestCase bug2202 = '[ruby-core:26074]' assert_raise(NoMethodError, bug2202) {o2.meth2} - %w(object_id __send__ initialize).each do |m| + %w(object_id __id__ __send__ initialize).each do |m| assert_in_out_err([], <<-INPUT, %w(:ok), %r"warning: removing '#{m}' may cause serious problems$") $VERBOSE = false begin |