From 311b7154839b91c87ee40908ac6d3f5c330d7b11 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 Feb 2016 07:45:58 +0000 Subject: [PATCH] test: use assert_not_* git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/io/wait/test_io_wait.rb | 6 +++--- test/net/http/test_http.rb | 22 +++++++++++----------- test/net/http/test_http_request.rb | 20 ++++++++++---------- test/net/http/test_httpresponse.rb | 2 +- test/openssl/test_buffering.rb | 8 ++++---- test/openssl/test_cipher.rb | 4 ++-- test/openssl/test_ssl.rb | 2 +- test/ruby/test_variable.rb | 2 +- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb index 7b9edea587..6c6fd83116 100644 --- a/test/io/wait/test_io_wait.rb +++ b/test/io/wait/test_io_wait.rb @@ -37,16 +37,16 @@ class TestIOWait < Test::Unit::TestCase end def test_ready? - refute @r.ready?, "shouldn't ready, but ready" + assert_not_predicate @r, :ready?, "shouldn't ready, but ready" @w.syswrite "." sleep 0.1 - assert @r.ready?, "should ready, but not" + assert_predicate @r, :ready?, "should ready, but not" end def test_buffered_ready? @w.syswrite ".\n!" assert_equal ".\n", @r.gets - assert @r.ready? + assert_predicate @r, :ready? end def test_wait diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index f1d3ede53e..493823549a 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -14,7 +14,7 @@ class TestNetHTTP < Test::Unit::TestCase 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 @@ -25,7 +25,7 @@ class TestNetHTTP < Test::Unit::TestCase 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' @@ -43,7 +43,7 @@ class TestNetHTTP < Test::Unit::TestCase 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 @@ -51,7 +51,7 @@ class TestNetHTTP < Test::Unit::TestCase assert_nil proxy_class.proxy_user 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' @@ -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, 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 @@ -562,12 +562,12 @@ module TestNetHTTP_version_1_2_methods assert_kind_of URI::Generic, req.uri - refute_equal uri, req.uri + assert_not_equal uri, req.uri assert_equal uri, res.uri - refute_same uri, req.uri - refute_same req.uri, res.uri + assert_not_same uri, req.uri + assert_not_same req.uri, res.uri end def _test_request__uri(http) @@ -578,12 +578,12 @@ module TestNetHTTP_version_1_2_methods assert_kind_of URI::Generic, req.uri - refute_equal uri, req.uri + assert_not_equal uri, req.uri assert_equal req.uri, res.uri - refute_same uri, req.uri - refute_same req.uri, res.uri + assert_not_same uri, req.uri + assert_not_same req.uri, res.uri end def _test_request__uri_host(http) diff --git a/test/net/http/test_http_request.rb b/test/net/http/test_http_request.rb index 35c935ac58..c2144d86c7 100644 --- a/test/net/http/test_http_request.rb +++ b/test/net/http/test_http_request.rb @@ -9,8 +9,8 @@ class HTTPRequestTest < Test::Unit::TestCase req = Net::HTTP::Get.new '/' assert_equal 'GET', req.method - refute req.request_body_permitted? - assert req.response_body_permitted? + assert_not_predicate req, :request_body_permitted? + assert_predicate req, :response_body_permitted? expected = { 'accept' => %w[*/*], @@ -27,8 +27,8 @@ class HTTPRequestTest < Test::Unit::TestCase req = Net::HTTP::Get.new '/', 'Range' => 'bytes=0-9' assert_equal 'GET', req.method - refute req.request_body_permitted? - assert req.response_body_permitted? + assert_not_predicate req, :request_body_permitted? + assert_predicate req, :response_body_permitted? expected = { 'accept' => %w[*/*], @@ -43,8 +43,8 @@ class HTTPRequestTest < Test::Unit::TestCase req = Net::HTTP::Head.new '/' assert_equal 'HEAD', req.method - refute req.request_body_permitted? - refute req.response_body_permitted? + assert_not_predicate req, :request_body_permitted? + assert_not_predicate req, :response_body_permitted? expected = { 'accept' => %w[*/*], @@ -61,8 +61,8 @@ class HTTPRequestTest < Test::Unit::TestCase req2 = Net::HTTP::Get.new '/', 'accept-encoding' => 'identity' - refute req2.decode_content, - 'Bug #7381 - do not decode content if the user overrides' + assert_not_predicate req2, :decode_content, + 'Bug #7381 - do not decode content if the user overrides' end if Net::HTTP::HAVE_ZLIB def test_header_set @@ -72,8 +72,8 @@ class HTTPRequestTest < Test::Unit::TestCase req['accept-encoding'] = 'identity' - refute req.decode_content, - 'Bug #7831 - do not decode content if the user overrides' + assert_not_predicate req, :decode_content, + 'Bug #7831 - do not decode content if the user overrides' end if Net::HTTP::HAVE_ZLIB end diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb index eb1a792e87..a494b7fb85 100644 --- a/test/net/http/test_httpresponse.rb +++ b/test/net/http/test_httpresponse.rb @@ -323,7 +323,7 @@ EOS response.uri = uri assert_equal uri, response.uri - refute_same uri, response.uri + assert_not_same uri, response.uri end def test_ensure_zero_space_does_not_regress diff --git a/test/openssl/test_buffering.rb b/test/openssl/test_buffering.rb index fe07b46a5e..1f552c935b 100644 --- a/test/openssl/test_buffering.rb +++ b/test/openssl/test_buffering.rb @@ -43,19 +43,19 @@ class OpenSSL::TestBuffering < Test::Unit::TestCase def test_flush @io.write 'a' - refute @io.sync + assert_not_predicate @io, :sync assert_empty @io.string assert_equal @io, @io.flush - refute @io.sync + assert_not_predicate @io, :sync assert_equal 'a', @io.string end def test_flush_error @io.write 'a' - refute @io.sync + assert_not_predicate @io, :sync assert_empty @io.string def @io.syswrite *a @@ -66,7 +66,7 @@ class OpenSSL::TestBuffering < Test::Unit::TestCase @io.flush end - refute @io.sync, 'sync must not change' + assert_not_predicate @io, :sync, 'sync must not change' end def test_getc diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb index 89c176f4de..dae069e43c 100644 --- a/test/openssl/test_cipher.rb +++ b/test/openssl/test_cipher.rb @@ -143,9 +143,9 @@ class OpenSSL::TestCipher < Test::Unit::TestCase def test_authenticated cipher = OpenSSL::Cipher.new('aes-128-gcm') - assert(cipher.authenticated?) + assert_predicate(cipher, :authenticated?) cipher = OpenSSL::Cipher.new('aes-128-cbc') - refute(cipher.authenticated?) + assert_not_predicate(cipher, :authenticated?) end def test_aes_gcm diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 58fcc0802a..0f740851b4 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -752,7 +752,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase ctx3 = OpenSSL::SSL::SSLContext.new ctx3.ciphers = "DH" - refute_predicate ctx3, :frozen? + assert_not_predicate ctx3, :frozen? ctx2 = OpenSSL::SSL::SSLContext.new ctx2.ciphers = "DH" diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 3fba8d1884..7432cbb6a2 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -144,7 +144,7 @@ class TestVariable < Test::Unit::TestCase end 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 v.remove_instance_variable(:@foo)