diff --git a/tests/json_generator_test.rb b/tests/json_generator_test.rb index fd70b0269..2436fa062 100755 --- a/tests/json_generator_test.rb +++ b/tests/json_generator_test.rb @@ -446,6 +446,15 @@ def test_invalid_encoding_string end if defined?(JSON::Ext::Generator) and RUBY_PLATFORM != "java" + def test_valid_utf8_in_different_encoding + utf8_string = "€™" + wrong_encoding_string = utf8_string.b + # This behavior is historical. Not necessary desirable. We should deprecated it. + # The pure and java version of the gem already don't behave this way. + assert_equal utf8_string.to_json, wrong_encoding_string.to_json + assert_equal JSON.dump(utf8_string), JSON.dump(wrong_encoding_string) + end + def test_string_ext_included_calls_super included = false diff --git a/tests/ractor_test.rb b/tests/ractor_test.rb index ba9bf7a7f..36196ed23 100644 --- a/tests/ractor_test.rb +++ b/tests/ractor_test.rb @@ -9,7 +9,7 @@ class JSONInRactorTest < Test::Unit::TestCase def test_generate - assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}", ignore_stderr: true) begin; $VERBOSE = nil require "json"