From bec4d053400c3a11c8efd68c3e8bd5ea4a0bcc54 Mon Sep 17 00:00:00 2001 From: taiyoslime Date: Mon, 5 Oct 2020 19:53:05 +0900 Subject: Introduce endless range (a part of #5085) Co-Authored-By: n4o847 <22975590+n4o847@users.noreply.github.com> Co-Authored-By: smallkirby --- test/t/array.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/t/array.rb') diff --git a/test/t/array.rb b/test/t/array.rb index eec31d751..8cc59720a 100644 --- a/test/t/array.rb +++ b/test/t/array.rb @@ -57,6 +57,7 @@ assert('Array#[]', '15.2.12.5.4') do a = [ "a", "b", "c", "d", "e" ] assert_equal(["b", "c"], a[1,2]) assert_equal(["b", "c", "d"], a[1..-2]) + assert_equal(["b", "c", "d", "e"], a[1..]) skip unless Object.const_defined?(:Float) assert_equal("b", a[1.1]) end @@ -92,6 +93,10 @@ assert('Array#[]=', '15.2.12.5.5') do a[2...4] = 6 assert_equal([1,2,6,5], a) + a = [1,2,3,4,5] + a[2...] = 6 + assert_equal([1,2,6], a) + # passing self (#3274) a = [1,2,3] a[1,0] = a -- cgit v1.2.3