From 66ef9b9310f5ce7fa58e44185160d56ceebd410f Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 12 Nov 2015 03:50:22 +0000 Subject: [PATCH] add a test. https://bugs.ruby-lang.org/issues/10984#note-13 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_hash.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index cb59524bd0..77417ecbe0 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1333,6 +1333,31 @@ class TestHash < Test::Unit::TestCase assert_not_operator(h2, :>, h2) end + def test_cmp_samekeys + h1 = {a:1} + h2 = {a:2} + + assert_operator(h1, :<=, h1) + assert_not_operator(h1, :<=, h2) + assert_not_operator(h2, :<=, h1) + assert_operator(h2, :<=, h2) + + assert_operator(h1, :>=, h1) + assert_not_operator(h1, :>=, h2) + assert_not_operator(h2, :>=, h1) + assert_operator(h2, :>=, h2) + + assert_not_operator(h1, :<, h1) + assert_not_operator(h1, :<, h2) + assert_not_operator(h2, :<, h1) + assert_not_operator(h2, :<, h2) + + assert_not_operator(h1, :>, h1) + assert_not_operator(h1, :>, h2) + assert_not_operator(h2, :>, h1) + assert_not_operator(h2, :>, h2) + end + def test_to_proc h = { 1 => 10,