diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-08 07:40:41 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-08 07:40:41 +0000 |
commit | 4902ef7d591fb01f6c9f70ec194e147c47935541 (patch) | |
tree | 223abaa69bf0f3a4effee7e478b95c471e09ae68 /test/json | |
parent | b16fd08622a5b79259c7af22ef2ce8b06652d79e (diff) | |
download | ruby-4902ef7d591fb01f6c9f70ec194e147c47935541.tar.gz |
* ext/json/parser/parser.rl (convert_encoding): should not modify
the argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/json')
-rwxr-xr-x | test/json/test_json.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/json/test_json.rb b/test/json/test_json.rb index 4c724fd36e..5f186f0c08 100755 --- a/test/json/test_json.rb +++ b/test/json/test_json.rb @@ -398,4 +398,17 @@ EOT json = JSON::Parser.allocate assert_raises(TypeError, '[ruby-core:35079]') {json.source} end + + def test_argument_encoding + source = "{}".force_encoding("ascii-8bit") + JSON::Parser.new(source) + assert_equal Encoding::ASCII_8BIT, source.encoding + end + + def test_frozen_argument + source = "{}".force_encoding("ascii-8bit") + source.freeze + parser = nil + assert_nothing_raised {parser = JSON::Parser.new(source)} + end end |