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

ruby-changes:43033

From: nobu <ko1@a...>
Date: Sun, 22 May 2016 03:06:19 +0900 (JST)
Subject: [ruby-changes:43033] nobu:r55107 (trunk): hash method values

nobu	2016-05-22 03:06:04 +0900 (Sun, 22 May 2016)

  New Revision: 55107

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

  Log:
    hash method values
    
    * test/ruby/test_{complex,range,rational,struct}.rb (test_hash):
      hash values should be an Integer, not only a Fixnum.

  Modified files:
    trunk/test/ruby/test_complex.rb
    trunk/test/ruby/test_range.rb
    trunk/test/ruby/test_rational.rb
    trunk/test/ruby/test_struct.rb
Index: test/ruby/test_rational.rb
===================================================================
--- test/ruby/test_rational.rb	(revision 55106)
+++ test/ruby/test_rational.rb	(revision 55107)
@@ -42,7 +42,7 @@ class Rational_Test < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rational.rb#L42
   end
 
   def test_hash
-    assert_fixnum(Rational(1,2).hash)
+    assert_kind_of(Integer, Rational(1,2).hash)
 
     h = {}
     h[Rational(0)] = 0
Index: test/ruby/test_range.rb
===================================================================
--- test/ruby/test_range.rb	(revision 55106)
+++ test/ruby/test_range.rb	(revision 55107)
@@ -138,7 +138,7 @@ class TestRange < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_range.rb#L138
   end
 
   def test_hash
-    assert_fixnum((0..1).hash)
+    assert_kind_of(Integer, (0..1).hash)
     assert_equal((0..1).hash, (0..1).hash)
     assert_not_equal((0..1).hash, (0...1).hash)
   end
Index: test/ruby/test_complex.rb
===================================================================
--- test/ruby/test_complex.rb	(revision 55106)
+++ test/ruby/test_complex.rb	(revision 55107)
@@ -48,8 +48,8 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L48
   end
 
   def test_hash
-    assert_fixnum(Complex(1,2).hash)
-    assert_fixnum(Complex(1.0,2.0).hash)
+    assert_kind_of(Integer, Complex(1,2).hash)
+    assert_kind_of(Integer, Complex(1.0,2.0).hash)
 
     h = {}
     h[Complex(0)] = 0
Index: test/ruby/test_struct.rb
===================================================================
--- test/ruby/test_struct.rb	(revision 55106)
+++ test/ruby/test_struct.rb	(revision 55107)
@@ -248,7 +248,7 @@ module TestStruct https://github.com/ruby/ruby/blob/trunk/test/ruby/test_struct.rb#L248
   def test_hash
     klass = @Struct.new(:a)
     o = klass.new(1)
-    assert_fixnum(o.hash)
+    assert_kind_of(Integer, o.hash)
   end
 
   def test_eql

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

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