summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext/test/array.rb
diff options
context:
space:
mode:
authorJun Hiroe <[email protected]>2014-04-21 01:35:00 +0900
committerJun Hiroe <[email protected]>2014-04-21 01:40:39 +0900
commit931414305ade73e3fa100a7bbf463db6c48881e4 (patch)
tree3743b6d715125ffe1ac25d46a4cf1113cb7521dc /mrbgems/mruby-array-ext/test/array.rb
parent791631ad4e8224475604322600a805f3cdae65f9 (diff)
downloadmruby-931414305ade73e3fa100a7bbf463db6c48881e4.tar.gz
mruby-931414305ade73e3fa100a7bbf463db6c48881e4.zip
Add Array#delete_if
Diffstat (limited to 'mrbgems/mruby-array-ext/test/array.rb')
-rw-r--r--mrbgems/mruby-array-ext/test/array.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb
index d157a5b4d..1fdfabe49 100644
--- a/mrbgems/mruby-array-ext/test/array.rb
+++ b/mrbgems/mruby-array-ext/test/array.rb
@@ -169,3 +169,17 @@ assert("Array#rotate!") do
assert_equal ["c", "d", "a", "b"], a.rotate(10)
assert_equal [], [].rotate!
end
+
+assert("Array#delete_if") do
+ a = [1, 2, 3, 4, 5]
+ assert_equal [1, 2, 3, 4, 5], a.delete_if { false }
+ assert_equal [1, 2, 3, 4, 5], a
+
+ a = [1, 2, 3, 4, 5]
+ assert_equal [], a.delete_if { true }
+ assert_equal [], a
+
+ a = [1, 2, 3, 4, 5]
+ assert_equal [1, 2, 3], a.delete_if { |i| i > 3 }
+ assert_equal [1, 2, 3], a
+end