summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-08 21:35:33 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-13 18:13:05 +0900
commite717d6faa8463c70407e6aaf116c6b6181f30be6 (patch)
tree8a8596542d9f1f6cde179a6151c51f8ff08c399a /test/ruby/test_io_m17n.rb
parentbdc8b3789ad388ff1d573369de6b085483b17098 (diff)
IO#set_encoding_by_bom
* io.c (rb_io_set_encoding_by_bom): IO#set_encoding_by_bom to set the encoding by BOM if exists. [Bug #15210]
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 6fb8d8a0cf..630f2eec08 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -2097,6 +2097,10 @@ EOT
assert_equal(Encoding::UTF_8, result.encoding, message)
assert_equal(stripped, result, message)
end
+
+ File.open(path, "rb") {|f|
+ assert_equal(Encoding.find(name), f.set_encoding_by_bom)
+ }
}
end
end
@@ -2139,6 +2143,10 @@ EOT
assert_equal(stripped, result, bug8323)
result = File.read(path, encoding: 'BOM|UTF-8:UTF-8')
assert_equal(stripped, result, bug8323)
+
+ File.open(path, "rb") {|f|
+ assert_nil(f.set_encoding_by_bom)
+ }
}
end