summaryrefslogtreecommitdiffhomepage
path: root/test/t/array.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-01-30 10:50:56 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-01-30 10:50:56 +0900
commitaa08158f67d8119ad5b68dafc4e58613fb839767 (patch)
tree69074c9486b59cb23799fce095fad083b77bb96f /test/t/array.rb
parent00062780882ad54f800b19412a1412bb864109b8 (diff)
downloadmruby-aa08158f67d8119ad5b68dafc4e58613fb839767.tar.gz
mruby-aa08158f67d8119ad5b68dafc4e58613fb839767.zip
Array#[]= is now range aware
Diffstat (limited to 'test/t/array.rb')
-rw-r--r--test/t/array.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/t/array.rb b/test/t/array.rb
index 54c3f2bde..1398bdc6e 100644
--- a/test/t/array.rb
+++ b/test/t/array.rb
@@ -69,6 +69,18 @@ assert('Array#[]=', '15.2.12.5.5') do
assert_equal(4, [1,2,3].[]=(1,4))
assert_equal(3, [1,2,3].[]=(1,2,3))
+
+ a = [1,2,3,4,5]
+ a[3..-1] = 6
+ assert_equal([1,2,3,6], a)
+
+ a = [1,2,3,4,5]
+ a[3..-1] = []
+ assert_equal([1,2,3], a)
+
+ a = [1,2,3,4,5]
+ a[2...4] = 6
+ assert_equal([1,2,6,5], a)
end
assert('Array#clear', '15.2.12.5.6') do