From 80646a7890a0e786f7f6f1614a519eccae3b0341 Mon Sep 17 00:00:00 2001 From: Jun Hiroe Date: Fri, 18 Apr 2014 21:57:11 +0900 Subject: Add a block argument with Array#uniq_bang --- mrbgems/mruby-array-ext/test/array.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mrbgems/mruby-array-ext/test/array.rb') diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb index 9a0f25f9a..3be17f187 100644 --- a/mrbgems/mruby-array-ext/test/array.rb +++ b/mrbgems/mruby-array-ext/test/array.rb @@ -36,6 +36,12 @@ 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 -- cgit v1.2.3