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:
parent
48fd404ffe
commit
86bbfdadf3
3 changed files with 9 additions and 0 deletions
|
@ -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>
|
Tue Aug 2 11:42:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (rb_enc_symname2_p): :! is valid symbol. [Bug #5136]
|
* parse.y (rb_enc_symname2_p): :! is valid symbol. [Bug #5136]
|
||||||
|
|
1
hash.c
1
hash.c
|
@ -1685,6 +1685,7 @@ recursive_hash(VALUE hash, VALUE dummy, int recur)
|
||||||
if (!RHASH(hash)->ntbl)
|
if (!RHASH(hash)->ntbl)
|
||||||
return LONG2FIX(0);
|
return LONG2FIX(0);
|
||||||
hval = RHASH(hash)->ntbl->num_entries;
|
hval = RHASH(hash)->ntbl->num_entries;
|
||||||
|
if (!hval) return LONG2FIX(0);
|
||||||
if (recur)
|
if (recur)
|
||||||
hval = rb_hash_uint(rb_hash_start(rb_hash(rb_cHash)), hval);
|
hval = rb_hash_uint(rb_hash_start(rb_hash(rb_cHash)), hval);
|
||||||
else
|
else
|
||||||
|
|
|
@ -809,6 +809,9 @@ class TestHash < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_hash2
|
def test_hash2
|
||||||
assert_kind_of(Integer, {}.hash)
|
assert_kind_of(Integer, {}.hash)
|
||||||
|
h = {1=>2}
|
||||||
|
h.shift
|
||||||
|
assert_equal({}.hash, h.hash, '[ruby-core:38650]')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update2
|
def test_update2
|
||||||
|
|
Loading…
Reference in a new issue