1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add tests of the encoding with BOM

This commit is contained in:
Nobuyoshi Nakada 2019-06-09 11:10:34 +09:00
parent f42588f754
commit a8ef498d6b
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -2089,11 +2089,11 @@ EOT
content = text.encode(name)
generate_file(path, content)
result = File.read(path, mode: 'rb:BOM|UTF-8')
assert_equal(content[1].force_encoding("ascii-8bit"),
result.force_encoding("ascii-8bit"))
assert_equal(Encoding.find(name), result.encoding, name)
assert_equal(content[1..-1].b, result.b, name)
result = File.read(path, mode: 'rb:BOM|UTF-8:UTF-8')
assert_equal(Encoding::UTF_8, result.encoding)
assert_equal(stripped, result)
assert_equal(Encoding::UTF_8, result.encoding, name)
assert_equal(stripped, result, name)
end
bug3407 = '[ruby-core:30641]'