summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-16 12:35:27 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-16 12:35:27 +0000
commit849e45dee80662c4192cbe9e6ce1161ac57c8edd (patch)
tree23e9cc760c78824cb486a0ecf875ea8c933258a5 /test
parent161fde4a43ba6f06abec13b28c82336f467eb6cf (diff)
merges r30536 from trunk into ruby_1_9_2.
-- * io.c (argf_next_argv): go advance when the next file cannot be read. [ruby-core:34446] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_argf.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index ffd5096789..678b811580 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -694,4 +694,20 @@ class TestArgf < Test::Unit::TestCase
assert_equal([@t1.path, @t2.path, @t3.path].inspect, f.gets.chomp)
end
end
+
+ def test_unreadable
+ bug4274 = '[ruby-core:34446]'
+ paths = (1..2).map do
+ t = Tempfile.new("bug4274-")
+ path = t.path
+ t.close!
+ path
+ end
+ argf = ARGF.class.new(*paths)
+ paths.each do |path|
+ e = assert_raise(Errno::ENOENT) {argf.gets}
+ assert_match(/- #{Regexp.quote(path)}\z/, e.message)
+ end
+ assert_nil(argf.gets, bug4274)
+ end
end