mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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/trunk@34417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a267b9512a
commit
2a6ccf6c13
3 changed files with 24 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Thu Feb 2 17:51:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.
|
||||
r34409 breaks replacing ARGV.
|
||||
[ruby-dev:45160] [Bug #5952]
|
||||
|
||||
Thu Feb 2 16:21:01 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* test/net/http/test_http.rb (TestNetHTTPKeepAlive#*): remove debug
|
||||
|
|
8
io.c
8
io.c
|
@ -7306,6 +7306,14 @@ argf_next_argv(VALUE argf)
|
|||
}
|
||||
ARGF.init_p = 1;
|
||||
}
|
||||
else {
|
||||
if (NIL_P(ARGF.argv)) {
|
||||
ARGF.next_p = -1;
|
||||
}
|
||||
else if (ARGF.next_p == -1 && RARRAY_LEN(ARGF.argv) > 0) {
|
||||
ARGF.next_p = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ARGF.next_p == 1) {
|
||||
retry:
|
||||
|
|
|
@ -678,6 +678,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
|
||||
|
|
Loading…
Reference in a new issue