summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext/test/array.rb
diff options
context:
space:
mode:
authorJun Hiroe <[email protected]>2014-04-21 22:14:04 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-23 00:22:24 +0900
commita48e0018fd8065d23f67fe354226ca346728ee87 (patch)
tree6ee9d4716b30b0d74ecbb02a22095122e391c749 /mrbgems/mruby-array-ext/test/array.rb
parent951f027b1274bb2e5ea7e5b943c9af21b4fc89d5 (diff)
downloadmruby-a48e0018fd8065d23f67fe354226ca346728ee87.tar.gz
mruby-a48e0018fd8065d23f67fe354226ca346728ee87.zip
Add Array#insert
Diffstat (limited to 'mrbgems/mruby-array-ext/test/array.rb')
-rw-r--r--mrbgems/mruby-array-ext/test/array.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb
index 0b425281f..d15ea2a64 100644
--- a/mrbgems/mruby-array-ext/test/array.rb
+++ b/mrbgems/mruby-array-ext/test/array.rb
@@ -197,3 +197,12 @@ assert("Array#reject!") do
assert_equal [1, 2, 3], a.reject! { |val| val > 3 }
assert_equal [1, 2, 3], a
end
+
+assert("Array#insert") do
+ a = ["a", "b", "c", "d"]
+ assert_equal ["a", "b", 99, "c", "d"], a.insert(2, 99)
+ assert_equal ["a", "b", 99, "c", 1, 2, 3, "d"], a.insert(-2, 1, 2, 3)
+
+ b = ["a", "b", "c", "d"]
+ assert_equal ["a", "b", "c", "d", nil, nil, 99], b.insert(6, 99)
+end