Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove_method of Module is private at Ruby 2.3 and 2.4 #544

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/json_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ def test_string_ext_included_calls_super
included = false

Module.send(:alias_method, :included_orig, :included)
Module.remove_method(:included)
Module.define_method(:included) do |base|
Module.send(:remove_method, :included)
Module.send(:define_method, :included) do |base|
included_orig(base)
included = true
end
Expand All @@ -409,9 +409,9 @@ 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.send(:remove_method, :included) if Module.method_defined?(:included)
Module.send(:alias_method, :included, :included_orig)
Module.remove_method(:included_orig)
Module.send(:remove_method, :included_orig)
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions tests/json_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def test_argument_encoding
end if defined?(Encoding::UTF_16)

def test_error_message_encoding
# https://github.com/flori/json/actions/runs/6478148162/job/17589572890
pend if RUBY_ENGINE == 'truffleruby'

bug10705 = '[ruby-core:67386] [Bug #10705]'
json = ".\"\xE2\x88\x9A\"".force_encoding(Encoding::UTF_8)
e = assert_raise(JSON::ParserError) {
Expand Down