зеркало из https://github.com/github/ruby.git
use dedicated assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fb979b4532
Коммит
08e74bfa2c
|
@ -124,10 +124,10 @@ module DRbCore
|
|||
ary = @there.to_a
|
||||
assert_kind_of(DRb::DRbObject, ary)
|
||||
|
||||
assert(@there.respond_to?(:to_a, true))
|
||||
assert(@there.respond_to?(:eval, true))
|
||||
assert(! @there.respond_to?(:eval, false))
|
||||
assert(! @there.respond_to?(:eval))
|
||||
assert_respond_to(@there, [:to_a, true])
|
||||
assert_respond_to(@there, [:eval, true])
|
||||
assert_not_respond_to(@there, [:eval, false])
|
||||
assert_not_respond_to(@there, :eval)
|
||||
end
|
||||
|
||||
def test_01_02_loop
|
||||
|
@ -171,20 +171,19 @@ module DRbCore
|
|||
|
||||
def test_04
|
||||
assert_respond_to(@there, 'sum')
|
||||
assert(!(@there.respond_to? "foobar"))
|
||||
assert_not_respond_to(@there, "foobar")
|
||||
end
|
||||
|
||||
def test_05_eq
|
||||
a = @there.to_a[0]
|
||||
b = @there.to_a[0]
|
||||
assert(a.object_id != b.object_id)
|
||||
assert(a == b)
|
||||
assert_not_same(a, b)
|
||||
assert_equal(a, b)
|
||||
assert(a == @there)
|
||||
assert_equal(a, @there)
|
||||
assert_equal(a.hash, b.hash)
|
||||
assert_equal(a.hash, @there.hash)
|
||||
assert(a.eql?(b))
|
||||
assert(a.eql?(@there))
|
||||
assert_operator(a, :eql?, b)
|
||||
assert_operator(a, :eql?, @there)
|
||||
end
|
||||
|
||||
def test_06_timeout
|
||||
|
|
|
@ -48,58 +48,58 @@ class ACLEntryTest < Test::Unit::TestCase
|
|||
a = ACL::ACLEntry.new("*")
|
||||
b = ACL::ACLEntry.new("all")
|
||||
@hostlist.each do |h|
|
||||
assert(a.match(h))
|
||||
assert(b.match(h))
|
||||
assert_operator(a, :match, h)
|
||||
assert_operator(b, :match, h)
|
||||
end
|
||||
end
|
||||
|
||||
def test_ip_v6
|
||||
a = ACL::ACLEntry.new('::ffff:192.0.0.0/104')
|
||||
assert(! a.match(@hosts['localhost']))
|
||||
assert(a.match(@hosts['yum']))
|
||||
assert(a.match(@hosts['ipv6']))
|
||||
assert(! a.match(@hosts['too']))
|
||||
assert_not_operator(a, :match, @hosts['localhost'])
|
||||
assert_operator(a, :match, @hosts['yum'])
|
||||
assert_operator(a, :match, @hosts['ipv6'])
|
||||
assert_not_operator(a, :match, @hosts['too'])
|
||||
end
|
||||
|
||||
def test_ip
|
||||
a = ACL::ACLEntry.new('192.0.0.0/8')
|
||||
assert(! a.match(@hosts['localhost']))
|
||||
assert(a.match(@hosts['yum']))
|
||||
assert_not_operator(a, :match, @hosts['localhost'])
|
||||
assert_operator(a, :match, @hosts['yum'])
|
||||
|
||||
a = ACL::ACLEntry.new('192.168.0.1/255.255.0.255')
|
||||
assert(! a.match(@hosts['localhost']))
|
||||
assert(! a.match(@hosts['yum']))
|
||||
assert(a.match(@hosts['x68k']))
|
||||
assert_not_operator(a, :match, @hosts['localhost'])
|
||||
assert_not_operator(a, :match, @hosts['yum'])
|
||||
assert_operator(a, :match, @hosts['x68k'])
|
||||
|
||||
a = ACL::ACLEntry.new('192.168.1.0/24')
|
||||
assert(! a.match(@hosts['localhost']))
|
||||
assert(a.match(@hosts['yum']))
|
||||
assert(a.match(@hosts['x68k']))
|
||||
assert_not_operator(a, :match, @hosts['localhost'])
|
||||
assert_operator(a, :match, @hosts['yum'])
|
||||
assert_operator(a, :match, @hosts['x68k'])
|
||||
|
||||
a = ACL::ACLEntry.new('92.0.0.0/8')
|
||||
assert(! a.match(@hosts['localhost']))
|
||||
assert(! a.match(@hosts['yum']))
|
||||
assert(! a.match(@hosts['x68k']))
|
||||
assert_not_operator(a, :match, @hosts['localhost'])
|
||||
assert_not_operator(a, :match, @hosts['yum'])
|
||||
assert_not_operator(a, :match, @hosts['x68k'])
|
||||
|
||||
a = ACL::ACLEntry.new('127.0.0.1/255.0.0.255')
|
||||
assert(a.match(@hosts['localhost']))
|
||||
assert(! a.match(@hosts['yum']))
|
||||
assert(! a.match(@hosts['x68k']))
|
||||
assert_operator(a, :match, @hosts['localhost'])
|
||||
assert_not_operator(a, :match, @hosts['yum'])
|
||||
assert_not_operator(a, :match, @hosts['x68k'])
|
||||
end
|
||||
|
||||
def test_name
|
||||
a = ACL::ACLEntry.new('*.jp')
|
||||
assert(! a.match(@hosts['localhost']))
|
||||
assert(a.match(@hosts['yum']))
|
||||
assert_not_operator(a, :match, @hosts['localhost'])
|
||||
assert_operator(a, :match, @hosts['yum'])
|
||||
|
||||
a = ACL::ACLEntry.new('yum.*.jp')
|
||||
assert(a.match(@hosts['yum']))
|
||||
assert(! a.match(@hosts['lc630']))
|
||||
assert_operator(a, :match, @hosts['yum'])
|
||||
assert_not_operator(a, :match, @hosts['lc630'])
|
||||
|
||||
a = ACL::ACLEntry.new('*.macos.or.jp')
|
||||
assert(a.match(@hosts['yum']))
|
||||
assert(a.match(@hosts['lc630']))
|
||||
assert(! a.match(@hosts['lib30']))
|
||||
assert_operator(a, :match, @hosts['yum'])
|
||||
assert_operator(a, :match, @hosts['lc630'])
|
||||
assert_not_operator(a, :match, @hosts['lib30'])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -124,29 +124,29 @@ class ACLListTest < Test::Unit::TestCase
|
|||
def test_all_1
|
||||
a = build(%w(all))
|
||||
@hostlist.each do |h|
|
||||
assert(a.match(h))
|
||||
assert_operator(a, :match, h)
|
||||
end
|
||||
end
|
||||
|
||||
def test_all_2
|
||||
a = build(%w(localhost 127.0.0.0/8 yum.* *))
|
||||
@hostlist.each do |h|
|
||||
assert(a.match(h))
|
||||
assert_operator(a, :match, h)
|
||||
end
|
||||
end
|
||||
|
||||
def test_1
|
||||
a = build(%w(192.0.0.1/255.0.0.255 yum.*.jp))
|
||||
assert(a.match(@hosts['yum']))
|
||||
assert(a.match(@hosts['x68k']))
|
||||
assert(! a.match(@hosts['lc630']))
|
||||
assert_operator(a, :match, @hosts['yum'])
|
||||
assert_operator(a, :match, @hosts['x68k'])
|
||||
assert_not_operator(a, :match, @hosts['lc630'])
|
||||
end
|
||||
|
||||
def test_2
|
||||
a = build(%w(*.linux.or.jp))
|
||||
assert(!a.match(@hosts['yum']))
|
||||
assert(a.match(@hosts['x68k']))
|
||||
assert(!a.match(@hosts['lc630']))
|
||||
assert_not_operator(a, :match, @hosts['yum'])
|
||||
assert_operator(a, :match, @hosts['x68k'])
|
||||
assert_not_operator(a, :match, @hosts['lc630'])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -161,14 +161,14 @@ class ACLTest < Test::Unit::TestCase
|
|||
def test_0
|
||||
a = ACL.new
|
||||
@hostlist.each do |h|
|
||||
assert(a.allow_addr?(h))
|
||||
assert_operator(a, :allow_addr?, h)
|
||||
end
|
||||
end
|
||||
|
||||
def test_not_0
|
||||
a = ACL.new([], ACL::ALLOW_DENY)
|
||||
@hostlist.each do |h|
|
||||
assert(! a.allow_addr?(h))
|
||||
assert_not_operator(a, :allow_addr?, h)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -178,9 +178,9 @@ class ACLTest < Test::Unit::TestCase
|
|||
allow x68k.*)
|
||||
|
||||
a = ACL.new(data)
|
||||
assert(a.allow_addr?(@hosts['x68k']))
|
||||
assert(a.allow_addr?(@hosts['localhost']))
|
||||
assert(! a.allow_addr?(@hosts['lc630']))
|
||||
assert_operator(a, :allow_addr?, @hosts['x68k'])
|
||||
assert_operator(a, :allow_addr?, @hosts['localhost'])
|
||||
assert_not_operator(a, :allow_addr?, @hosts['lc630'])
|
||||
end
|
||||
|
||||
def test_not_1
|
||||
|
@ -189,9 +189,9 @@ class ACLTest < Test::Unit::TestCase
|
|||
allow x68k.*)
|
||||
|
||||
a = ACL.new(data, ACL::ALLOW_DENY)
|
||||
assert(!a.allow_addr?(@hosts['x68k']))
|
||||
assert(a.allow_addr?(@hosts['localhost']))
|
||||
assert(! a.allow_addr?(@hosts['lc630']))
|
||||
assert_not_operator(a, :allow_addr?, @hosts['x68k'])
|
||||
assert_operator(a, :allow_addr?, @hosts['localhost'])
|
||||
assert_not_operator(a, :allow_addr?, @hosts['lc630'])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -121,10 +121,10 @@ class TestDRbYield < Test::Unit::TestCase
|
|||
|
||||
def test_06_taint
|
||||
x = proc {}
|
||||
assert(! x.tainted?)
|
||||
assert_not_predicate(x, :tainted?)
|
||||
@there.echo_yield(x) {|o|
|
||||
assert_equal(x, o)
|
||||
assert(! x.tainted?)
|
||||
assert_not_predicate(x, :tainted?)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -393,7 +393,7 @@ class TestBug4409 < Test::Unit::TestCase
|
|||
|
||||
def test_bug4409
|
||||
foo = @there.foo
|
||||
assert(@there.foo?(foo))
|
||||
assert_operator(@there, :foo?, foo)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче