From 8df1ace64a7695c855bf0a774e3fd70edfab0bf3 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Tue, 10 Aug 2021 01:07:06 +0200 Subject: Fix ARGF.read(length) short read [Bug #18074] --- test/ruby/test_argf.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index 7922e5ad07..76a2720d47 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 -- cgit v1.2.3