Skip to content

Commit

Permalink
Prevent a warning: method redefined; discarding old included
Browse files Browse the repository at this point in the history
```
[ 3463/25719] JSONGeneratorTest#test_string_ext_included_calls_super/home/chkbuild/chkbuild/tmp/build/20230905T063003Z/ruby/test/json/json_generator_test.rb:411: warning: method redefined; discarding old included
/home/chkbuild/chkbuild/tmp/build/20230905T063003Z/ruby/test/json/json_generator_test.rb:399: warning: previous definition of included was here
```

http://rubyci.s3.amazonaws.com/debian10/ruby-master/log/20230905T063003Z.log.html.gz
  • Loading branch information
mame authored and hsbt committed Sep 13, 2023
1 parent 3dc6db8 commit d81a22c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/json_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ def test_string_ext_included_calls_super
included = false

Module.alias_method(:included_orig, :included)
Module.remove_method(:included)
Module.define_method(:included) do |base|
included_orig(base)
included = true
Expand All @@ -408,6 +409,7 @@ def test_string_ext_included_calls_super
assert included
ensure
if Module.private_method_defined?(:included_orig)
Module.remove_method(:included) if Module.method_defined?(:included)
Module.alias_method(:included, :included_orig)
Module.remove_method(:included_orig)
end
Expand Down

0 comments on commit d81a22c

Please sign in to comment.