diff options
| author | Jun Hiroe <[email protected]> | 2014-04-24 22:49:52 +0900 |
|---|---|---|
| committer | Jun Hiroe <[email protected]> | 2014-04-24 23:04:46 +0900 |
| commit | d4bec4d6571132e759658bb8819d71d96b83d55c (patch) | |
| tree | d7af0f752ab92b33b36fd47e945421e940410d3a /mrbgems/mruby-array-ext/test | |
| parent | 39c036ab037b13d62149f4736ae7808e411d0029 (diff) | |
| download | mruby-d4bec4d6571132e759658bb8819d71d96b83d55c.tar.gz mruby-d4bec4d6571132e759658bb8819d71d96b83d55c.zip | |
Add Array#delete_if
Diffstat (limited to 'mrbgems/mruby-array-ext/test')
| -rw-r--r-- | mrbgems/mruby-array-ext/test/array.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb index a82fb08b3..ba1d4fd75 100644 --- a/mrbgems/mruby-array-ext/test/array.rb +++ b/mrbgems/mruby-array-ext/test/array.rb @@ -223,3 +223,16 @@ assert("Array#insert") do b = ["a", "b", "c", "d"] assert_equal ["a", "b", "c", "d", nil, nil, 99], b.insert(6, 99) 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 { |val| val > 3 } +end |
