diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-14 06:20:41 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-14 06:20:41 +0000 |
commit | 4fe4f46592c2ba4d42a25e8559d51307b24ee0af (patch) | |
tree | de2007f330cd7868d1b7226008ff6c573eeacbb8 /test | |
parent | 9c03800575286a49cc034ffbf92a79937187062b (diff) |
merge revision(s) 50339,50340,50342,50343: [Backport #10705]
parser.rl: use StringValue
* ext/json/parser/parser.rl (cParser_initialize): use StringValue
instead of direct rb_convert_type and remove duplicate
conversion.
* ext/json/parser/parser.rl: raise with messages in UTF-8
encoding. [ruby-core:67386] [Bug #10705]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rwxr-xr-x | 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 462650e861..98ef9708da 100755 --- a/test/json/test_json.rb +++ b/test/json/test_json.rb @@ -544,4 +544,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 |