diff options
author | Hiroshi SHIBATA <[email protected]> | 2024-10-16 11:16:17 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-10-16 11:24:25 +0900 |
commit | 8af6606b225ade043322cf9d50ac9622c3f69226 (patch) | |
tree | 8b174e64802e3921d1f081af2a183ff4b84e1ffe | |
parent | fdbead76ec83a791b0319c7db29e210a410015f4 (diff) |
Restore missing test-case from https://github.com/ruby/json/commit/c5a6d8042752dca312cfb407a6d3e594458d1cd6
Co-authored-by: "Jean Boussier" <[email protected]>
-rwxr-xr-x | test/json/json_generator_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb index fd70b02699..2436fa0627 100755 --- a/test/json/json_generator_test.rb +++ b/test/json/json_generator_test.rb @@ -446,6 +446,15 @@ EOT 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 |