[ruby/json] Fix JSON::GeneratorError#detailed_message with Ruby < 3.2

2e015ff839
This commit is contained in:
Rahim Packir Saibo 2025-03-05 18:03:03 +00:00 committed by Hiroshi SHIBATA
parent f7af75d3d9
commit e20f1f76f4
2 changed files with 13 additions and 2 deletions

View file

@ -410,6 +410,14 @@ class JSONGeneratorTest < Test::Unit::TestCase
end
end
def test_json_generate_error_detailed_message
error = assert_raise JSON::GeneratorError do
generate(["\xea"])
end
assert_not_nil(error.detailed_message)
end
def test_json_generate_unsupported_types
assert_raise JSON::GeneratorError do
generate(Object.new, strict: true)