mirror of
https://github.com/ruby/ruby.git
synced 2026-01-29 05:24:23 +00:00
[ruby/json] Assume Encoding is defined
https://github.com/ruby/json/commit/8713aa4812
This commit is contained in:
parent
20dc1e5c25
commit
8feed977a0
@ -479,9 +479,7 @@ EOT
|
||||
end
|
||||
end
|
||||
|
||||
if defined?(Encoding)
|
||||
def test_nonutf8_encoding
|
||||
assert_equal("\"5\u{b0}\"", "5\xb0".force_encoding("iso-8859-1").to_json)
|
||||
end
|
||||
def test_nonutf8_encoding
|
||||
assert_equal("\"5\u{b0}\"", "5\xb0".force_encoding("iso-8859-1").to_json)
|
||||
end
|
||||
end
|
||||
|
||||
@ -24,13 +24,13 @@ class JSONParserTest < Test::Unit::TestCase
|
||||
source = "{}".encode("UTF-16")
|
||||
JSON::Parser.new(source)
|
||||
assert_equal Encoding::UTF_16, source.encoding
|
||||
end if defined?(Encoding::UTF_16)
|
||||
end
|
||||
|
||||
def test_argument_encoding_for_binary
|
||||
source = "{}".encode("ASCII-8BIT")
|
||||
JSON::Parser.new(source)
|
||||
assert_equal Encoding::ASCII_8BIT, source.encoding
|
||||
end if defined?(Encoding::ASCII_8BIT)
|
||||
end
|
||||
|
||||
def test_error_message_encoding
|
||||
pend if RUBY_ENGINE == 'truffleruby'
|
||||
@ -42,7 +42,7 @@ class JSONParserTest < Test::Unit::TestCase
|
||||
}
|
||||
assert_equal(Encoding::UTF_8, e.message.encoding, bug10705)
|
||||
assert_include(e.message, json, bug10705)
|
||||
end if defined?(Encoding::UTF_8) and defined?(JSON::Ext::Parser)
|
||||
end if defined?(JSON::Ext::Parser)
|
||||
|
||||
def test_parsing
|
||||
parser = JSON::Parser.new('"test"')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user