From 523bf31564f160f899f8cf9f73540d6a6f687f17 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 29 Aug 2021 10:32:12 +0900 Subject: [PATCH] Add negative position tests [Bug #18138] --- test/ruby/test_array.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 78e497d345..59e1ad463c 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1576,6 +1576,8 @@ class TestArray < Test::Unit::TestCase assert_nil(a.slice(10, -3)) assert_equal @cls[], a.slice(10..7) + + assert_equal([100], a.slice(-1, 1_000_000_000)) end def test_slice! @@ -1635,6 +1637,8 @@ class TestArray < Test::Unit::TestCase assert_nil(a.clone.slice!(10, -3)) assert_equal @cls[], a.clone.slice!(10..7) + + assert_equal([100], a.clone.slice!(-1, 1_000_000_000)) end def test_sort