From 74f724de1acf9773a4220dedb544b80d4a7311a5 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 3 Sep 2011 14:52:18 +0000 Subject: * io.c (argf_next_argv): open in default text mode. [ruby-core:39234] [Bug #5268] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_argf.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test/ruby/test_argf.rb') diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index e249c757ea..a588e07fcb 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -641,12 +641,23 @@ class TestArgf < Test::Unit::TestCase end def test_binmode + bug5268 = '[ruby-core:39234]' + open(@t3.path, "wb") {|f| f.write "5\r\n6\r\n"} ruby('-e', "ARGF.binmode; STDOUT.binmode; puts ARGF.read", @t1.path, @t2.path, @t3.path) do |f| f.binmode - assert_equal("1\n2\n3\n4\n5\n6\n", f.read) + assert_equal("1\n2\n3\n4\n5\r\n6\r\n", f.read, bug5268) end end + def test_textmode + bug5268 = '[ruby-core:39234]' + open(@t3.path, "wb") {|f| f.write "5\r\n6\r\n"} + ruby('-e', "STDOUT.binmode; puts ARGF.read", @t1.path, @t2.path, @t3.path) do |f| + f.binmode + assert_equal("1\n2\n3\n4\n5\n6\n", f.read, bug5268) + end + end unless IO::BINARY.zero? + def test_skip ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f| ARGF.skip -- cgit v1.2.3