summaryrefslogtreecommitdiff
path: root/test/ruby/test_argf.rb
diff options
context:
space:
mode:
authorCsaba Henk <csaba@redhat.com>2021-08-10 01:07:06 +0200
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-08-10 11:32:45 +0900
commit8df1ace64a7695c855bf0a774e3fd70edfab0bf3 (patch)
treeeca9074744ad99e5f9a463eb94cd435510773b44 /test/ruby/test_argf.rb
parent510c3655c9789f93e799499cd7923461e2743ec0 (diff)
Fix ARGF.read(length) short read [Bug #18074]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4727
Diffstat (limited to 'test/ruby/test_argf.rb')
-rw-r--r--test/ruby/test_argf.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index 7922e5ad079..76a2720d475 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -1110,4 +1110,13 @@ class TestArgf < Test::Unit::TestCase
assert_raise(TypeError, bug11610) {gets}
};
end
+
+ def test_sized_read
+ [@t1, @t2, @t3].each { |t|
+ open(t.path, "wb") { |f| f.write "t" }
+ }
+ ruby('-e', "print ARGF.read(3).size", @t1.path, @t2.path, @t3.path) do |f|
+ assert_equal("3", f.read)
+ end
+ end
end