diff options
| author | Jun Hiroe <[email protected]> | 2014-04-27 23:31:58 +0900 |
|---|---|---|
| committer | Jun Hiroe <[email protected]> | 2014-04-27 23:34:24 +0900 |
| commit | cdef46e3d99835c48592ab08d1383612786820a7 (patch) | |
| tree | 9add21bf0010cbd8cf6848e98988088da4facec4 /mrbgems/mruby-array-ext/test | |
| parent | bbc237044d0fb1792dff8c5d2466f4e644821239 (diff) | |
| download | mruby-cdef46e3d99835c48592ab08d1383612786820a7.tar.gz mruby-cdef46e3d99835c48592ab08d1383612786820a7.zip | |
Add Array#select_bang
Diffstat (limited to 'mrbgems/mruby-array-ext/test')
| -rw-r--r-- | mrbgems/mruby-array-ext/test/array.rb | 14 |
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 c76423522..f94189356 100644 --- a/mrbgems/mruby-array-ext/test/array.rb +++ b/mrbgems/mruby-array-ext/test/array.rb @@ -266,3 +266,17 @@ assert("Array#keep_if") do assert_equal [4, 5], a.keep_if { |val| val > 3 } assert_equal [4, 5], a end + +assert("Array#select!") do + a = [1, 2, 3, 4, 5] + assert_nil a.select! { true } + assert_equal [1, 2, 3, 4, 5], a + + a = [1, 2, 3, 4, 5] + assert_equal [], a.select! { false } + assert_equal [], a + + a = [1, 2, 3, 4, 5] + assert_equal [4, 5], a.select! { |val| val > 3 } + assert_equal [4, 5], a +end |
