diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-25 00:02:48 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-25 00:02:48 +0900 |
| commit | f882bc8480f4728052c29b55464c0432a1bb7428 (patch) | |
| tree | d7af0f752ab92b33b36fd47e945421e940410d3a /mrbgems/mruby-array-ext/test/array.rb | |
| parent | 39c036ab037b13d62149f4736ae7808e411d0029 (diff) | |
| parent | d4bec4d6571132e759658bb8819d71d96b83d55c (diff) | |
| download | mruby-f882bc8480f4728052c29b55464c0432a1bb7428.tar.gz mruby-f882bc8480f4728052c29b55464c0432a1bb7428.zip | |
Merge pull request #2120 from suzukaze/add-array.delete_if
Add Array#delete_if
Diffstat (limited to 'mrbgems/mruby-array-ext/test/array.rb')
| -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 |
