summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-21 06:23:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-21 06:23:18 +0000
commitc3bd53b167bb9a0c94c3927b962c946e5b728ae9 (patch)
tree9e64bc35aa83a7e97c1f65577e87b69a609b85e9 /test/ruby/test_io_m17n.rb
parentc3944b2d1f2adaf2dbef5952e26590e95a267921 (diff)
test_io_m17n.rb: BOM with non-UTF
* test/ruby/test_io_m17n.rb (test_bom_non_utf): assert BOM with non-UTF encoding in encoding option, for r53084. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 233b93d0b3e..13d056b54d8 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -2103,11 +2103,24 @@ EOT
}
assert_equal(Encoding::US_ASCII, enc)
+ enc = nil
+ assert_warn(/BOM/) {
+ open(__FILE__, "r", encoding: "bom|us-ascii") {|f| enc = f.external_encoding}
+ }
+ assert_equal(Encoding::US_ASCII, enc)
+
+ enc = nil
assert_warn(/BOM/) {
open(IO::NULL, "w:bom|us-ascii") {|f| enc = f.external_encoding}
}
assert_equal(Encoding::US_ASCII, enc)
+ enc = nil
+ assert_warn(/BOM/) {
+ open(IO::NULL, "w", encoding: "bom|us-ascii") {|f| enc = f.external_encoding}
+ }
+ assert_equal(Encoding::US_ASCII, enc)
+
tlhInganHol = "\u{f8e4 f8d9 f8d7 f8dc f8d0 f8db} \u{f8d6 f8dd f8d9}"
EnvUtil.with_default_external(Encoding::UTF_8) {
assert_warn(/#{tlhInganHol}/) {