diff options
author | Jeremy Evans <[email protected]> | 2022-05-26 10:37:01 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2022-08-25 13:36:17 -0700 |
commit | 21cac42385e1a116d287e155e461453b830640d2 (patch) | |
tree | 63d7677ff07a004e2150c733ea6369dd6d549dd6 /test/ruby/test_io.rb | |
parent | 881bc2a1765e7c19ab389c53841adc5ac329f1aa (diff) |
Raise ArgumentError for IO.foreach with limit of 0
Makes behavior consistent with IO.readlines.
Fixes [Bug #18767]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5954
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 2 |
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) |