1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test: use assert_not_*

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-02-19 07:45:58 +00:00
parent 6286ff6301
commit 311b715483
8 changed files with 33 additions and 33 deletions

View file

@ -37,16 +37,16 @@ class TestIOWait < Test::Unit::TestCase
end end
def test_ready? def test_ready?
refute @r.ready?, "shouldn't ready, but ready" assert_not_predicate @r, :ready?, "shouldn't ready, but ready"
@w.syswrite "." @w.syswrite "."
sleep 0.1 sleep 0.1
assert @r.ready?, "should ready, but not" assert_predicate @r, :ready?, "should ready, but not"
end end
def test_buffered_ready? def test_buffered_ready?
@w.syswrite ".\n!" @w.syswrite ".\n!"
assert_equal ".\n", @r.gets assert_equal ".\n", @r.gets
assert @r.ready? assert_predicate @r, :ready?
end end
def test_wait def test_wait

View file

@ -14,7 +14,7 @@ class TestNetHTTP < Test::Unit::TestCase
proxy_class = Net::HTTP.Proxy 'proxy.example', 8000, 'user', 'pass' proxy_class = Net::HTTP.Proxy 'proxy.example', 8000, 'user', 'pass'
refute_equal Net::HTTP, proxy_class assert_not_equal Net::HTTP, proxy_class
assert_operator proxy_class, :<, Net::HTTP assert_operator proxy_class, :<, Net::HTTP
@ -25,7 +25,7 @@ class TestNetHTTP < Test::Unit::TestCase
http = proxy_class.new 'hostname.example' http = proxy_class.new 'hostname.example'
refute http.proxy_from_env? assert_not_predicate http, :proxy_from_env?
proxy_class = Net::HTTP.Proxy 'proxy.example' proxy_class = Net::HTTP.Proxy 'proxy.example'
@ -43,7 +43,7 @@ class TestNetHTTP < Test::Unit::TestCase
proxy_class = Net::HTTP.Proxy :ENV proxy_class = Net::HTTP.Proxy :ENV
refute_equal Net::HTTP, proxy_class assert_not_equal Net::HTTP, proxy_class
assert_operator proxy_class, :<, Net::HTTP assert_operator proxy_class, :<, Net::HTTP
@ -51,7 +51,7 @@ class TestNetHTTP < Test::Unit::TestCase
assert_nil proxy_class.proxy_user assert_nil proxy_class.proxy_user
assert_nil proxy_class.proxy_pass assert_nil proxy_class.proxy_pass
refute_equal 8000, proxy_class.proxy_port assert_not_equal 8000, proxy_class.proxy_port
http = proxy_class.new 'hostname.example' http = proxy_class.new 'hostname.example'
@ -488,7 +488,7 @@ module TestNetHTTP_version_1_2_methods
assert_equal $test_net_http_data.size, res.body.size assert_equal $test_net_http_data.size, res.body.size
assert_equal $test_net_http_data, res.body assert_equal $test_net_http_data, res.body
refute res.decode_content, 'Bug #7831' if Net::HTTP::HAVE_ZLIB assert_not_predicate res, :decode_content, 'Bug #7831' if Net::HTTP::HAVE_ZLIB
} }
end end
@ -562,12 +562,12 @@ module TestNetHTTP_version_1_2_methods
assert_kind_of URI::Generic, req.uri assert_kind_of URI::Generic, req.uri
refute_equal uri, req.uri assert_not_equal uri, req.uri
assert_equal uri, res.uri assert_equal uri, res.uri
refute_same uri, req.uri assert_not_same uri, req.uri
refute_same req.uri, res.uri assert_not_same req.uri, res.uri
end end
def _test_request__uri(http) def _test_request__uri(http)
@ -578,12 +578,12 @@ module TestNetHTTP_version_1_2_methods
assert_kind_of URI::Generic, req.uri assert_kind_of URI::Generic, req.uri
refute_equal uri, req.uri assert_not_equal uri, req.uri
assert_equal req.uri, res.uri assert_equal req.uri, res.uri
refute_same uri, req.uri assert_not_same uri, req.uri
refute_same req.uri, res.uri assert_not_same req.uri, res.uri
end end
def _test_request__uri_host(http) def _test_request__uri_host(http)

View file

@ -9,8 +9,8 @@ class HTTPRequestTest < Test::Unit::TestCase
req = Net::HTTP::Get.new '/' req = Net::HTTP::Get.new '/'
assert_equal 'GET', req.method assert_equal 'GET', req.method
refute req.request_body_permitted? assert_not_predicate req, :request_body_permitted?
assert req.response_body_permitted? assert_predicate req, :response_body_permitted?
expected = { expected = {
'accept' => %w[*/*], 'accept' => %w[*/*],
@ -27,8 +27,8 @@ class HTTPRequestTest < Test::Unit::TestCase
req = Net::HTTP::Get.new '/', 'Range' => 'bytes=0-9' req = Net::HTTP::Get.new '/', 'Range' => 'bytes=0-9'
assert_equal 'GET', req.method assert_equal 'GET', req.method
refute req.request_body_permitted? assert_not_predicate req, :request_body_permitted?
assert req.response_body_permitted? assert_predicate req, :response_body_permitted?
expected = { expected = {
'accept' => %w[*/*], 'accept' => %w[*/*],
@ -43,8 +43,8 @@ class HTTPRequestTest < Test::Unit::TestCase
req = Net::HTTP::Head.new '/' req = Net::HTTP::Head.new '/'
assert_equal 'HEAD', req.method assert_equal 'HEAD', req.method
refute req.request_body_permitted? assert_not_predicate req, :request_body_permitted?
refute req.response_body_permitted? assert_not_predicate req, :response_body_permitted?
expected = { expected = {
'accept' => %w[*/*], 'accept' => %w[*/*],
@ -61,7 +61,7 @@ class HTTPRequestTest < Test::Unit::TestCase
req2 = Net::HTTP::Get.new '/', 'accept-encoding' => 'identity' req2 = Net::HTTP::Get.new '/', 'accept-encoding' => 'identity'
refute req2.decode_content, assert_not_predicate req2, :decode_content,
'Bug #7381 - do not decode content if the user overrides' 'Bug #7381 - do not decode content if the user overrides'
end if Net::HTTP::HAVE_ZLIB end if Net::HTTP::HAVE_ZLIB
@ -72,7 +72,7 @@ class HTTPRequestTest < Test::Unit::TestCase
req['accept-encoding'] = 'identity' req['accept-encoding'] = 'identity'
refute req.decode_content, assert_not_predicate req, :decode_content,
'Bug #7831 - do not decode content if the user overrides' 'Bug #7831 - do not decode content if the user overrides'
end if Net::HTTP::HAVE_ZLIB end if Net::HTTP::HAVE_ZLIB

View file

@ -323,7 +323,7 @@ EOS
response.uri = uri response.uri = uri
assert_equal uri, response.uri assert_equal uri, response.uri
refute_same uri, response.uri assert_not_same uri, response.uri
end end
def test_ensure_zero_space_does_not_regress def test_ensure_zero_space_does_not_regress

View file

@ -43,19 +43,19 @@ class OpenSSL::TestBuffering < Test::Unit::TestCase
def test_flush def test_flush
@io.write 'a' @io.write 'a'
refute @io.sync assert_not_predicate @io, :sync
assert_empty @io.string assert_empty @io.string
assert_equal @io, @io.flush assert_equal @io, @io.flush
refute @io.sync assert_not_predicate @io, :sync
assert_equal 'a', @io.string assert_equal 'a', @io.string
end end
def test_flush_error def test_flush_error
@io.write 'a' @io.write 'a'
refute @io.sync assert_not_predicate @io, :sync
assert_empty @io.string assert_empty @io.string
def @io.syswrite *a def @io.syswrite *a
@ -66,7 +66,7 @@ class OpenSSL::TestBuffering < Test::Unit::TestCase
@io.flush @io.flush
end end
refute @io.sync, 'sync must not change' assert_not_predicate @io, :sync, 'sync must not change'
end end
def test_getc def test_getc

View file

@ -143,9 +143,9 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
def test_authenticated def test_authenticated
cipher = OpenSSL::Cipher.new('aes-128-gcm') cipher = OpenSSL::Cipher.new('aes-128-gcm')
assert(cipher.authenticated?) assert_predicate(cipher, :authenticated?)
cipher = OpenSSL::Cipher.new('aes-128-cbc') cipher = OpenSSL::Cipher.new('aes-128-cbc')
refute(cipher.authenticated?) assert_not_predicate(cipher, :authenticated?)
end end
def test_aes_gcm def test_aes_gcm

View file

@ -752,7 +752,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
ctx3 = OpenSSL::SSL::SSLContext.new ctx3 = OpenSSL::SSL::SSLContext.new
ctx3.ciphers = "DH" ctx3.ciphers = "DH"
refute_predicate ctx3, :frozen? assert_not_predicate ctx3, :frozen?
ctx2 = OpenSSL::SSL::SSLContext.new ctx2 = OpenSSL::SSL::SSLContext.new
ctx2.ciphers = "DH" ctx2.ciphers = "DH"

View file

@ -144,7 +144,7 @@ class TestVariable < Test::Unit::TestCase
end end
assert_nil v.instance_variable_get(:@foo) assert_nil v.instance_variable_get(:@foo)
refute v.instance_variable_defined?(:@foo) assert_not_send([v, :instance_variable_defined?, :@foo])
assert_raise_with_message(RuntimeError, msg) do assert_raise_with_message(RuntimeError, msg) do
v.remove_instance_variable(:@foo) v.remove_instance_variable(:@foo)