зеркало из https://github.com/github/ruby.git
hash method values
* test/ruby/test_{complex,range,rational,struct}.rb (test_hash): hash values should be an Integer, not only a Fixnum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f73e6f5a53
Коммит
a7955b31c0
|
@ -48,8 +48,8 @@ class Complex_Test < Test::Unit::TestCase
|
|||
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
|
||||
|
|
|
@ -138,7 +138,7 @@ class TestRange < Test::Unit::TestCase
|
|||
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
|
||||
|
|
|
@ -42,7 +42,7 @@ class Rational_Test < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_hash
|
||||
assert_fixnum(Rational(1,2).hash)
|
||||
assert_kind_of(Integer, Rational(1,2).hash)
|
||||
|
||||
h = {}
|
||||
h[Rational(0)] = 0
|
||||
|
|
|
@ -248,7 +248,7 @@ module TestStruct
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче