summaryrefslogtreecommitdiff
path: root/test/json/test_json.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-08 07:40:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-08 07:40:41 +0000
commit4902ef7d591fb01f6c9f70ec194e147c47935541 (patch)
tree223abaa69bf0f3a4effee7e478b95c471e09ae68 /test/json/test_json.rb
parentb16fd08622a5b79259c7af22ef2ce8b06652d79e (diff)
* 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/test_json.rb')
-rwxr-xr-xtest/json/test_json.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/json/test_json.rb b/test/json/test_json.rb
index 4c724fd..5f186f0 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