summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-11 05:46:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-11 05:46:36 +0000
commitcb7075a6a2e57bea2c689baa79df15cccbc206b0 (patch)
tree04375d6bee7dafb8bd82c5ae43e4743af7ed97a2 /test/ruby/test_io_m17n.rb
parentc51a9689033dc9cc3deb6e4cca8d7d6aeb91457b (diff)
* test/ruby/test_io_m17n.rb (test_strip_bom): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index ce942a8528..aed688e591 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -1691,5 +1691,19 @@ EOT
assert_equal("\"&#x4E02;\"".force_encoding("ascii-8bit"), content)
}
end
+
+ def test_strip_bom
+ with_tmpdir {
+ text = "\uFEFFa"
+ %w/UTF-8 UTF-16BE UTF-16LE UTF-32BE UTF-32LE/.each do |name|
+ path = '%s-bom.txt' % name
+ content = text.encode(name)
+ generate_file(path, content)
+ result = File.read(path, mode: 'rb:utf-7-bom')
+ assert_equal(content[1].force_encoding("ascii-8bit"),
+ result.force_encoding("ascii-8bit"))
+ end
+ }
+ end
end