summaryrefslogtreecommitdiff
path: root/test/json
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-18 06:19:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-18 06:19:52 +0000
commitb38c0b7974854003a949a26f87bd7ff0e17113ef (patch)
treee6f8aef83b00a06d0fe1d21c5591dccf550a29e6 /test/json
parenteac21c897a7693ac5e440e87455b9744f4208d64 (diff)
parser.rl: rb_enc_raise
* 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/trunk@50342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/json')
-rwxr-xr-x[-rw-r--r--]test/json/test_json.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/json/test_json.rb b/test/json/test_json.rb
index 7957773..46f0001 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