1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (recursive_hash): hash value of emptied hash should be

equal to an empty hash.  [ruby-core:38650]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-08-02 03:03:18 +00:00
parent 48fd404ffe
commit 86bbfdadf3
3 changed files with 9 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Tue Aug 2 12:03:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* hash.c (recursive_hash): hash value of emptied hash should be
equal to an empty hash. [ruby-core:38650]
Tue Aug 2 11:42:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (rb_enc_symname2_p): :! is valid symbol. [Bug #5136]

1
hash.c
View file

@ -1685,6 +1685,7 @@ recursive_hash(VALUE hash, VALUE dummy, int recur)
if (!RHASH(hash)->ntbl)
return LONG2FIX(0);
hval = RHASH(hash)->ntbl->num_entries;
if (!hval) return LONG2FIX(0);
if (recur)
hval = rb_hash_uint(rb_hash_start(rb_hash(rb_cHash)), hval);
else

View file

@ -809,6 +809,9 @@ class TestHash < Test::Unit::TestCase
def test_hash2
assert_kind_of(Integer, {}.hash)
h = {1=>2}
h.shift
assert_equal({}.hash, h.hash, '[ruby-core:38650]')
end
def test_update2