File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,15 @@ def test_invalid_encoding_string
446446 end
447447
448448 if defined? ( JSON ::Ext ::Generator ) and RUBY_PLATFORM != "java"
449+ def test_valid_utf8_in_different_encoding
450+ utf8_string = "€™"
451+ wrong_encoding_string = utf8_string . b
452+ # This behavior is historical. Not necessary desirable. We should deprecated it.
453+ # The pure and java version of the gem already don't behave this way.
454+ assert_equal utf8_string . to_json , wrong_encoding_string . to_json
455+ assert_equal JSON . dump ( utf8_string ) , JSON . dump ( wrong_encoding_string )
456+ end
457+
449458 def test_string_ext_included_calls_super
450459 included = false
451460
Original file line number Diff line number Diff line change 99
1010class JSONInRactorTest < Test ::Unit ::TestCase
1111 def test_generate
12- assert_separately ( [ ] , "#{ <<~"begin;" } \n #{ <<~'end;' } " )
12+ assert_separately ( [ ] , "#{ <<~"begin;" } \n #{ <<~'end;' } " , ignore_stderr : true )
1313 begin;
1414 $VERBOSE = nil
1515 require "json"
You can’t perform that action at this time.
0 commit comments