From 02b70256b5171d4b85ea7eeab836d3d7cfb3dbfc Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 26 Nov 2024 10:55:49 +0900 Subject: Check negative integer underflow --- test/ruby/test_string.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index ba8d86d442..c8b9aeb597 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -164,6 +164,11 @@ CODE assert_raise(ArgumentError) { "foo"[] } end + def test_AREF_underflow + require "rbconfig/sizeof" + assert_equal(nil, S("\u{3042 3044 3046}")[RbConfig::LIMITS["LONG_MIN"], 1]) + end + def test_ASET # '[]=' s = S("FooBar") s[0] = S('A') -- cgit v1.2.3