diff options
author | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-06 19:38:20 +0000 |
---|---|---|
committer | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-06 19:38:20 +0000 |
commit | 3cf4fe47e80548011c5c136c7447f24b587c40e6 (patch) | |
tree | eddb9de7ba3b97653075caf38365dbd355b732b7 /test/ruby/test_array.rb | |
parent | 7dfbcc85d2e31fcb9af50c66486e82e1bc4dc2df (diff) | |
download | ruby-3cf4fe47e80548011c5c136c7447f24b587c40e6.tar.gz |
array.c: return first unique element in Array#uniq
* array.c (ary_add_hash): Fix consistency issue between Array#uniq and
Array#uniq! [Bug #9340] [ruby-core:59457]
* test/ruby/test_array.rb (class TestArray): regression test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r-- | test/ruby/test_array.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index b648c404ed..6ff304acb2 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1524,6 +1524,11 @@ class TestArray < Test::Unit::TestCase assert(a.none?(&:frozen?)) assert_equal(%w(a), b) assert(b.none?(&:frozen?)) + + bug9340 = "[ruby-core:59457]" + ary = [bug9340, bug9340.dup, bug9340.dup] + assert_equal 1, ary.uniq.size + assert_same bug9340, ary.uniq[0] end def test_uniq_with_block |