[ruby/json] Move create_addtions logic in Ruby.

By leveraging the `on_load` callback we can move all this logic
out of the parser. Which mean we no longer have to duplicate
that logic in both parser and that we'll later be able to extract
it entirely from the gem.

f411ddf1ce
This commit is contained in:
Jean Boussier 2025-03-27 12:25:08 +01:00 committed by Hiroshi SHIBATA
parent e8c46f4ca5
commit ec171b4075
Notes: git 2025-03-28 03:45:12 +00:00
4 changed files with 130 additions and 156 deletions

View file

@ -151,7 +151,12 @@ class JSONAdditionTest < Test::Unit::TestCase
end
def test_deprecated_load_create_additions
assert_deprecated_warning(/use JSON\.unsafe_load/) do
pattern = /json_addition_test\.rb.*use JSON\.unsafe_load/
if RUBY_ENGINE == 'truffleruby'
pattern = /use JSON\.unsafe_load/
end
assert_deprecated_warning(pattern) do
JSON.load(JSON.dump(Time.now))
end
end