diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-19 00:01:08 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-19 00:01:08 +0900 |
| commit | 751e74a8fbec99ff51504cbc598fd455d09e1595 (patch) | |
| tree | 25466cbaa26b13fa9ca9fdae5db02dacbf0fc09e /mrbgems/mruby-array-ext/test | |
| parent | 73c0ea5ffa77ca551c17d03fc5dbb99d95072844 (diff) | |
| parent | cb5e6edb7f8fa1117192da7732446229d93993c8 (diff) | |
| download | mruby-751e74a8fbec99ff51504cbc598fd455d09e1595.tar.gz mruby-751e74a8fbec99ff51504cbc598fd455d09e1595.zip | |
Merge pull request #2078 from suzukaze/add-block-with-array.uniq_bang
Add block argument with Array#uniq! and Array#uniq
Diffstat (limited to 'mrbgems/mruby-array-ext/test')
| -rw-r--r-- | mrbgems/mruby-array-ext/test/array.rb | 9 |
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 9a0f25f9a..d157a5b4d 100644 --- a/mrbgems/mruby-array-ext/test/array.rb +++ b/mrbgems/mruby-array-ext/test/array.rb @@ -36,12 +36,21 @@ assert("Array#uniq!") do b = [ "a", "b", "c" ] assert_nil b.uniq! + + c = [["student","sam"], ["student","george"], ["teacher","matz"]] + assert_equal [["student", "sam"], ["teacher", "matz"]], c.uniq! { |s| s.first } + + d = [["student","sam"], ["teacher","matz"]] + assert_nil d.uniq! { |s| s.first } end assert("Array#uniq") do a = [1, 2, 3, 1] assert_equal [1, 2, 3], a.uniq assert_equal [1, 2, 3, 1], a + + b = [["student","sam"], ["student","george"], ["teacher","matz"]] + assert_equal [["student", "sam"], ["teacher", "matz"]], b.uniq { |s| s.first } end assert("Array#-") do |
