aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2022-05-26 10:37:01 -0700
committerJeremy Evans <code@jeremyevans.net>2022-08-25 13:36:17 -0700
commit21cac42385e1a116d287e155e461453b830640d2 (patch)
tree63d7677ff07a004e2150c733ea6369dd6d549dd6 /test/ruby/test_io.rb
parent881bc2a1765e7c19ab389c53841adc5ac329f1aa (diff)
downloadruby-21cac42385e1a116d287e155e461453b830640d2.tar.gz
Raise ArgumentError for IO.foreach with limit of 0
Makes behavior consistent with IO.readlines. Fixes [Bug #18767]
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r--test/ruby/test_io.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 6a3d7594cf..d6fcf16ddd 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2602,6 +2602,8 @@ class TestIO < Test::Unit::TestCase
bug = '[ruby-dev:31525]'
assert_raise(ArgumentError, bug) {IO.foreach}
+ assert_raise(ArgumentError, "[Bug #18767] [ruby-core:108499]") {IO.foreach(__FILE__, 0){}}
+
a = nil
assert_nothing_raised(ArgumentError, bug) {a = IO.foreach(t.path).to_a}
assert_equal(["foo\n", "bar\n", "baz\n"], a, bug)