mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
b16fd08622
commit
4902ef7d59
4 changed files with 24 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue