summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-09 20:12:02 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-09 20:12:02 +0000
commit36b3d5577ca9c9e32fa690149d73d557af996422 (patch)
tree8aa46568cdf61990c1fec5aaba1ec86dd11de8bc /test
parent0234bcfd19aa0a7b4152809c13554144b7322f41 (diff)
merge revision(s) 34409,34412,34417:
* io.c (argf_close): skip stdin, which should be readable again. [ruby-dev:45160] [Bug #5952] * io.c (argf_readlines): reinitialize after all read to be readable again. * io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace. r34409 breaks replacing ARGV. [ruby-dev:45160] [Bug #5952] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_argf.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index a033a74d32..bf6996f0de 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -685,6 +685,16 @@ class TestArgf < Test::Unit::TestCase
end
end
+ def test_close_replace
+ ruby('-e', <<-SRC) do |f|
+ ARGF.close
+ ARGV.replace ['#{@t1.path}', '#{@t2.path}', '#{@t3.path}']
+ puts ARGF.read
+ SRC
+ assert_equal("1\n2\n3\n4\n5\n6\n", f.read)
+ end
+ end
+
def test_closed
ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f|
3.times do
@@ -748,4 +758,9 @@ class TestArgf < Test::Unit::TestCase
end
assert_nil(argf.gets, bug4274)
end
+
+ def test_readlines_twice
+ bug5952 = '[ruby-dev:45160]'
+ assert_ruby_status(["-e", "2.times {STDIN.tty?; readlines}"], "", bug5952)
+ end
end