summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2026-05-07 13:54:05 +0900
committergit <svn-admin@ruby-lang.org>2026-05-07 05:03:57 +0000
commit66b1559d39aac8dec41a8ab4d207be9375ecf6d1 (patch)
tree86dfa34c617773203d087e0d47e976d62dc9d535 /test
parentc4df92d6dbda68937eb033b17403a738cc551999 (diff)
[ruby/stringio] Check arguments in pread
https://github.com/ruby/stringio/commit/efe8351676
Diffstat (limited to 'test')
-rw-r--r--test/stringio/test_stringio.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index 656c0bb91d..aca250a85a 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -831,9 +831,11 @@ class TestStringIO < Test::Unit::TestCase
assert_raise(EOFError) { f.pread(1, 5) }
assert_raise(ArgumentError) { f.pread(-1, 0) }
assert_raise(Errno::EINVAL) { f.pread(3, -1) }
+ assert_raise(Errno::EINVAL) { f.pread(0, -1) }
+ assert_raise(IOError) { StringIO.new(nil, "w").pread(3, 0) }
+ assert_raise(TypeError) { f.pread(3, 0, []) }
assert_equal "".b, StringIO.new("").pread(0, 0)
- assert_equal "".b, StringIO.new("").pread(0, -10)
buf = "stale".b
assert_equal "stale".b, StringIO.new("").pread(0, 0, buf)