summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2015-05-15 17:42:39 +0200
committerFlorian Frank <flori@ping.de>2015-05-15 17:42:39 +0200
commit82a56b631e02465d5d14a2bafb1ad3b9983daf4a (patch)
tree7282116480d96d91679d3b70a114bcab8f804ef9 /tests
parent73643a96b64f696fd43320e28601e557079f1461 (diff)
parentc9c99679d6c59df9ff39042edf5ac20bd0f7466a (diff)
downloadjson-be-compatible-with-ruby-2.2.1.tar.gz
Merge branch 'parse_error_encoding' of https://github.com/nobu/json into be-compatible-with-ruby-2.2.1be-compatible-with-ruby-2.2.1
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_json.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_json.rb b/tests/test_json.rb
index 7957773..46f0001 100755
--- a/tests/test_json.rb
+++ b/tests/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