summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-28 13:40:50 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-28 13:40:50 +0000
commit03a7970e953df23ce4b6c4debb5e2cfe1182dc21 (patch)
tree2adda30694c4ca760693d991cb70f608183b67f3 /test
parentb70f6464e0d5c120610dd2b107c78436b219147d (diff)
merges r30736,r30738 and r30739 from trunk into ruby_1_9_2.
-- * array.c (rb_ary_uniq_bang): call ARY_SET_LEN(ary, 0) before rb_resize_capa because rb_resize_capa expects resized length is smaller than current array length. call rb_ary_unshare before rb_resize_capa because rb_resize_capa losts the reference to original shared array. -- Add ML Reference and a test for r30736 [ruby-core:34997] -- Additional fix for r30736 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_array.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 1c80f2d145..6170e916ac 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1456,6 +1456,12 @@ class TestArray < Test::Unit::TestCase
assert_raise(ArgumentError) { a.uniq!(1) }
assert_raise(ArgumentError) { f.uniq!(1) }
assert_raise(RuntimeError) { f.uniq! }
+
+ assert_nothing_raised do
+ a = [ {c: "b"}, {c: "r"}, {c: "w"}, {c: "g"}, {c: "g"} ]
+ a.sort_by!{|e| e[:c]}
+ a.uniq! {|e| e[:c]}
+ end
end
def test_uniq_bang_with_block