Add negative position tests [Bug #18138]

This commit is contained in:
Nobuyoshi Nakada 2021-08-29 10:32:12 +09:00
parent 5dc36ddcd0
commit 523bf31564
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -1576,6 +1576,8 @@ class TestArray < Test::Unit::TestCase
assert_nil(a.slice(10, -3)) assert_nil(a.slice(10, -3))
assert_equal @cls[], a.slice(10..7) assert_equal @cls[], a.slice(10..7)
assert_equal([100], a.slice(-1, 1_000_000_000))
end end
def test_slice! def test_slice!
@ -1635,6 +1637,8 @@ class TestArray < Test::Unit::TestCase
assert_nil(a.clone.slice!(10, -3)) assert_nil(a.clone.slice!(10, -3))
assert_equal @cls[], a.clone.slice!(10..7) assert_equal @cls[], a.clone.slice!(10..7)
assert_equal([100], a.clone.slice!(-1, 1_000_000_000))
end end
def test_sort def test_sort