summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-22 09:52:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-22 09:52:35 +0000
commit4154b96068eab8fc5e9359ad26747e9dabdceea1 (patch)
treeb5a33c5aaa64a868950a8ffc5de72586374628da /test/ruby
parent5caaef7ad9b384969a037284272645939ec3c9c6 (diff)
hash.c: fix Hash#compact! return value
* hash.c (rb_hash_compact_bang): should return nil if no elements is deleted. [ruby-core:77709] [Bug #12863] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_hash.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 7720b6098e..c0ccd65fca 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -358,8 +358,9 @@ class TestHash < Test::Unit::TestCase
h = @cls[a: 1, b: nil, c: false, d: true, e: nil]
assert_equal({a: 1, c: false, d: true}, h.compact)
assert_equal({a: 1, b: nil, c: false, d: true, e: nil}, h)
- h.compact!
+ assert_same(h, h.compact!)
assert_equal({a: 1, c: false, d: true}, h)
+ assert_nil(h.compact!)
end
def test_dup