diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-03-13 19:13:37 +0900 |
---|---|---|
committer | git <[email protected]> | 2024-03-13 13:20:23 +0000 |
commit | 3f8ef7ff7c09e67a48eff33804060803b9f11119 (patch) | |
tree | bea4f20c489b40f66ab80e3289c3086453c48342 /test/stringio/test_stringio.rb | |
parent | 2fc551e34e3d1310986e0e2727aadcd39ba06925 (diff) |
[ruby/stringio] Define `StringIO::MAX_LENGTH`
https://github.com/ruby/stringio/commit/0205bd1c86
Diffstat (limited to 'test/stringio/test_stringio.rb')
-rw-r--r-- | test/stringio/test_stringio.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index ae8e845497..b0eff57c77 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -237,9 +237,8 @@ class TestStringIO < Test::Unit::TestCase def test_write_integer_overflow f = StringIO.new + f.pos = StringIO::MAX_LENGTH assert_raise(ArgumentError) { - # JRuby errors when setting pos to an out-of-range value - f.pos = RbConfig::LIMITS["LONG_MAX"] f.write("pos + len overflows") } end @@ -900,8 +899,9 @@ class TestStringIO < Test::Unit::TestCase end def test_overflow - return if RbConfig::SIZEOF["void*"] > RbConfig::SIZEOF["long"] - limit = RbConfig::LIMITS["INTPTR_MAX"] - 0x10 + intptr_max = RbConfig::LIMITS["INTPTR_MAX"] + return if intptr_max > StringIO::MAX_LENGTH + limit = intptr_max - 0x10 assert_separately(%w[-rstringio], "#{<<-"begin;"}\n#{<<-"end;"}") begin; limit = #{limit} |