diff options
Diffstat (limited to 'test/json/test_json.rb')
-rwxr-xr-x[-rw-r--r--] | test/json/test_json.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/json/test_json.rb b/test/json/test_json.rb index 7957773f23..46f000148f 100644..100755 --- a/test/json/test_json.rb +++ b/test/json/test_json.rb @@ -550,4 +550,14 @@ EOT JSON::Parser.new(source) assert_equal Encoding::ASCII_8BIT, source.encoding end if defined?(Encoding::ASCII_8BIT) + + def test_error_message_encoding + bug10705 = '[ruby-core:67386] [Bug #10705]' + json = "\"\xE2\x88\x9A\"".force_encoding(Encoding::UTF_8) + e = assert_raise(JSON::ParserError) { + JSON.parse(json) + } + assert_equal(Encoding::UTF_8, e.message.encoding, bug10705) + assert_include(e.message, json, bug10705) + end if defined?(Encoding::UTF_8) end |