mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/ruby: better assertions
* test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
287d2adab0
commit
3ac0ec4ecd
45 changed files with 532 additions and 510 deletions
|
@ -189,14 +189,14 @@ module TestStruct
|
|||
o1 = klass1.new(1)
|
||||
o2 = klass1.new(1)
|
||||
o3 = klass2.new(1)
|
||||
assert(o1.==(o2))
|
||||
assert(o1 != o3)
|
||||
assert_equal(o1, o2)
|
||||
assert_not_equal(o1, o3)
|
||||
end
|
||||
|
||||
def test_hash
|
||||
klass = @Struct.new(:a)
|
||||
o = klass.new(1)
|
||||
assert(o.hash.is_a?(Fixnum))
|
||||
assert_kind_of(Fixnum, o.hash)
|
||||
end
|
||||
|
||||
def test_eql
|
||||
|
@ -205,8 +205,8 @@ module TestStruct
|
|||
o1 = klass1.new(1)
|
||||
o2 = klass1.new(1)
|
||||
o3 = klass2.new(1)
|
||||
assert(o1.eql?(o2))
|
||||
assert(!(o1.eql?(o3)))
|
||||
assert_operator(o1, :eql?, o2)
|
||||
assert_not_operator(o1, :eql?, o3)
|
||||
end
|
||||
|
||||
def test_size
|
||||
|
@ -255,26 +255,26 @@ module TestStruct
|
|||
x = klass1.new(1, 2, nil); x.c = x
|
||||
y = klass1.new(1, 2, nil); y.c = y
|
||||
Timeout.timeout(1) {
|
||||
assert x == y
|
||||
assert x.eql? y
|
||||
assert_equal x, y
|
||||
assert_operator x, :eql?, y
|
||||
}
|
||||
|
||||
z = klass1.new(:something, :other, nil); z.c = z
|
||||
Timeout.timeout(1) {
|
||||
assert x != z
|
||||
assert !x.eql?(z)
|
||||
assert_not_equal x, z
|
||||
assert_not_operator x, :eql?, z
|
||||
}
|
||||
|
||||
x.c = y; y.c = x
|
||||
Timeout.timeout(1) {
|
||||
assert x == y
|
||||
assert x.eql?(y)
|
||||
assert_equal x, y
|
||||
assert_operator x, :eql?, y
|
||||
}
|
||||
|
||||
x.c = z; z.c = x
|
||||
Timeout.timeout(1) {
|
||||
assert x != z
|
||||
assert !x.eql?(z)
|
||||
assert_not_equal x, z
|
||||
assert_not_operator x, :eql?, z
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue