[前][次][番号順一覧][スレッド一覧]

ruby-changes:67279

From: Nobuyoshi <ko1@a...>
Date: Sun, 29 Aug 2021 10:35:42 +0900 (JST)
Subject: [ruby-changes:67279] 523bf31564 (master): Add negative position tests [Bug #18138]

https://git.ruby-lang.org/ruby.git/commit/?id=523bf31564

From 523bf31564f160f899f8cf9f73540d6a6f687f17 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 29 Aug 2021 10:32:12 +0900
Subject: 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 78e497d..59e1ad4 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1576,6 +1576,8 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L1576
 
     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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L1637
 
     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
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]