ruby-changes:21095
From: usa <ko1@a...>
Date: Wed, 31 Aug 2011 16:30:25 +0900 (JST)
Subject: [ruby-changes:21095] usa:r33144 (trunk): * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
usa 2011-08-31 16:29:57 +0900 (Wed, 31 Aug 2011) New Revision: 33144 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33144 Log: * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish, default_mode_on_unix,text_mode,binary_mode}): tests for [Bug # 5164]. Modified files: trunk/ChangeLog trunk/test/ruby/test_io_m17n.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 33143) +++ ChangeLog (revision 33144) @@ -1,3 +1,8 @@ +Wed Aug 31 16:28:04 2011 NAKAMURA Usaku <usa@r...> + + * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish, + default_mode_on_unix,text_mode,binary_mode}): tests for [Bug #5164]. + Wed Aug 31 15:54:11 2011 NARUSE, Yui <naruse@r...> * ext/json: Merge json gem v1.5.4 (3dab4c5a6a97fac03dac). Index: test/ruby/test_io_m17n.rb =================================================================== --- test/ruby/test_io_m17n.rb (revision 33143) +++ test/ruby/test_io_m17n.rb (revision 33144) @@ -2069,5 +2069,32 @@ } assert(c.ascii_only?, "should be ascii_only #{bug4557}") end + + def test_default_mode_on_dosish + with_tmpdir { + open("a", "w") {|f| f.puts} + assert_equal("\r\n", IO.binread("a")) + } + end if /mswin|mingw/ =~ RUBY_PLATFORM + + def test_default_mode_on_unix + with_tmpdir { + open("a", "w") {|f| f.puts} + assert_equal("\n", IO.binread("a")) + } + end unless /mswin|mingw/ =~ RUBY_PLATFORM + + def test_text_mode + with_tmpdir { + open("a", "wt") {|f| f.puts} + assert_equal("\r\n", IO.binread("a")) + } + end + + def test_binary_mode + with_tmpdir { + open("a", "wb") {|f| f.puts} + assert_equal("\n", IO.binread("a")) + } + end end - -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/