summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,