summaryrefslogtreecommitdiff
path: root/tests/test_json.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2011-07-08 06:46:06 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2011-07-08 06:59:35 +0900
commit1b19c43a4f459988474f86ccbbfc92a420af58e8 (patch)
tree16efe5f1ffd17c3b93466a229085d00e6680f5b0 /tests/test_json.rb
parent08793aa47dfca15f678842fd5cd583fe2fb67136 (diff)
downloadjson-1b19c43a4f459988474f86ccbbfc92a420af58e8.tar.gz
should not modify argument
* ext/json/ext/parser/parser.h (FORCE_UTF8): should not modify encoding of the argument.
Diffstat (limited to 'tests/test_json.rb')
-rwxr-xr-xtests/test_json.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_json.rb b/tests/test_json.rb
index 5b43ec9..825a507 100755
--- a/tests/test_json.rb
+++ b/tests/test_json.rb
@@ -415,4 +415,10 @@ EOT
assert_raise(TypeError, '[ruby-core:35079]') {parser.source}
end
end
+
+ def test_argument_encoding
+ source = "{}".force_encoding("ascii-8bit")
+ JSON::Parser.new(source)
+ assert_equal Encoding::ASCII_8BIT, source.encoding
+ end if defined?(Encoding::ASCII_8BIT)
end