diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-31 07:29:57 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-31 07:29:57 +0000 |
commit | 8b74d0c3fb195058c18a939af1faa96fda9f4860 (patch) | |
tree | b79e0fed304d78b318cce634a34f9189a8be86fb /test/ruby/test_io_m17n.rb | |
parent | c06658feba7ae82e175bac72f241029276e715a0 (diff) | |
download | ruby-8b74d0c3fb195058c18a939af1faa96fda9f4860.tar.gz |
* 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].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 091b04a5af..01dca47f7f 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -2069,5 +2069,32 @@ EOT } assert(c.ascii_only?, "should be ascii_only #{bug4557}") end -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 |