Skip to content

Commit

Permalink
Add negative position tests [Bug #18138]
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Aug 29, 2021
1 parent 5dc36dd commit 523bf31
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/ruby/test_array.rb
Expand Up @@ -1576,6 +1576,8 @@ def test_slice_out_of_range

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!
Expand Down Expand Up @@ -1635,6 +1637,8 @@ def test_slice_out_of_range!

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
Expand Down

0 comments on commit 523bf31

Please sign in to comment.