diff options
author | Jeremy Evans <[email protected]> | 2023-02-10 10:33:53 -0800 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2023-03-24 12:29:00 -0700 |
commit | 6c60006de5cfd75f10a1b4a3d822e2de41d22db6 (patch) | |
tree | 846c8feffac56b046d35059a001d095c2283bda9 /test/ruby/test_io.rb | |
parent | 836e9a192ba4fdc56a2d3d94f5840869f77fd3bf (diff) |
Raise ArgumentError if IO.read is provided negative offset
Fixes [Bug #19380]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7289
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 0716dd7bf9..f57dee4261 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2866,6 +2866,9 @@ class TestIO < Test::Unit::TestCase assert_equal("foo\nbar\nbaz\n", File.read(t.path)) assert_equal("foo\nba", File.read(t.path, 6)) assert_equal("bar\n", File.read(t.path, 4, 4)) + + assert_raise(ArgumentError) { File.read(t.path, -1) } + assert_raise(ArgumentError) { File.read(t.path, 1, -1) } } end |