summaryrefslogtreecommitdiff
path: root/test/json/test_json.rb
diff options
context:
space:
mode:
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 4c724fd36e2..5f186f0c08a 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