[前][次][番号順一覧][スレッド一覧]

ruby-changes:40463

From: akr <ko1@a...>
Date: Thu, 12 Nov 2015 12:50:31 +0900 (JST)
Subject: [ruby-changes:40463] akr:r52544 (trunk): add a test.

akr	2015-11-12 12:50:22 +0900 (Thu, 12 Nov 2015)

  New Revision: 52544

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52544

  Log:
    add a test.
    
    https://bugs.ruby-lang.org/issues/10984#note-13

  Modified files:
    trunk/test/ruby/test_hash.rb
Index: test/ruby/test_hash.rb
===================================================================
--- test/ruby/test_hash.rb	(revision 52543)
+++ test/ruby/test_hash.rb	(revision 52544)
@@ -1333,6 +1333,31 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L1333
     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,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]