diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-07 16:19:47 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-07 16:19:47 +0000 |
| commit | 6b4c2401aa5386fe138e8d796c22769cabb999b0 (patch) | |
| tree | 567b120be0069957d7f5e79e45c9389f662f2edf | |
| parent | 8a3a464dcbd54e8d9d2e998e6faae9d37aff5081 (diff) | |
* hash.c (hash_i): make Hash#hash order insensitive.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | hash.c | 1 | ||||
| -rw-r--r-- | test/ruby/test_hash.rb | 3 |
3 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Sun Jun 8 01:15:11 2008 Tanaka Akira <akr@fsij.org> + + * hash.c (hash_i): make Hash#hash order insensitive. + Sat Jun 7 22:15:02 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * configure.in (VENDOR_DIR): use LIBDIR instead of PREFIX as well as @@ -1602,7 +1602,6 @@ hash_i(key, val, hval) { if (key == Qundef) return ST_CONTINUE; *hval ^= rb_hash(key); - *hval *= 137; *hval ^= rb_hash(val); return ST_CONTINUE; } diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 38d72f701b..4131a6bdd3 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -635,4 +635,7 @@ class TestHash < Test::Unit::TestCase assert_equal([], expected - vals) end + def test_hash_hash + assert_equal({0=>2,11=>1}.hash, {11=>1,0=>2}.hash) + end end |
