ruby-changes:12337
From: naruse <ko1@a...>
Date: Sat, 11 Jul 2009 14:48:29 +0900 (JST)
Subject: [ruby-changes:12337] Ruby:r24032 (trunk): * test/ruby/test_io_m17n.rb (test_strip_bom): added.
naruse 2009-07-11 14:46:36 +0900 (Sat, 11 Jul 2009) New Revision: 24032 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24032 Log: * test/ruby/test_io_m17n.rb (test_strip_bom): added. Modified files: trunk/ChangeLog trunk/test/ruby/test_io_m17n.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 24031) +++ ChangeLog (revision 24032) @@ -1,3 +1,7 @@ +Sat Jul 11 14:43:34 2009 NARUSE, Yui <naruse@r...> + + * test/ruby/test_io_m17n.rb (test_strip_bom): added. + Sat Jul 11 07:11:59 2009 Nobuyoshi Nakada <nobu@r...> * ext/readline/readline.c (readline_attempted_completion_function): Index: test/ruby/test_io_m17n.rb =================================================================== --- test/ruby/test_io_m17n.rb (revision 24031) +++ test/ruby/test_io_m17n.rb (revision 24032) @@ -1691,5 +1691,19 @@ assert_equal("\"丂\"".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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/