diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-28 00:54:19 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-28 00:54:19 +0000 |
commit | ed737b87d46521e5bf082138f251eb3018966821 (patch) | |
tree | 57417318d6f1a03dcf075e15920c113eadf318a3 /test/ruby/test_float.rb | |
parent | 3a312317e68a8365edbd71cda5729c3d08d27bbb (diff) |
merge revision(s) 49999,50000: [Backport #10979]
* hash.c (rb_any_hash): use same hash values with Float#hash so
that -0.0 and +0.0 will be identical.
[ruby-core:68541] [Bug #10979]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_float.rb')
-rw-r--r-- | test/ruby/test_float.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index b8b4da6f43..a959f60a69 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -619,4 +619,12 @@ class TestFloat < Test::Unit::TestCase assert_in_epsilon(10.0, ("1."+"1"*300000).to_f*9) end; end + + def test_hash_0 + bug10979 = '[ruby-core:68541] [Bug #10979]' + assert_equal(+0.0.hash, -0.0.hash) + assert_operator(+0.0, :eql?, -0.0) + h = {0.0 => bug10979} + assert_equal(bug10979, h[-0.0]) + end end |