aboutsummaryrefslogtreecommitdiffstats
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
commit969e1e88d214d6ec5545888970d4117cf95b4957 (patch)
tree5db783ada00f6c44e29184e81ee77a7a69106aa2
parent87380416fbf06fa0ec72a05408e8f8a11305b6a2 (diff)
downloadruby-969e1e88d214d6ec5545888970d4117cf95b4957.tar.gz
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 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,