summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-12 03:50:22 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-12 03:50:22 +0000
commit66ef9b9310f5ce7fa58e44185160d56ceebd410f (patch)
tree5db783ada00f6c44e29184e81ee77a7a69106aa2
parentfd36c7524d4921a6230832ccfb4304c31c99419d (diff)
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
-rw-r--r--test/ruby/test_hash.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index cb59524..77417ec 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,