[前][次][番号順一覧][スレッド一覧]

ruby-changes:41797

From: nobu <ko1@a...>
Date: Fri, 19 Feb 2016 16:45:30 +0900 (JST)
Subject: [ruby-changes:41797] nobu:r53871 (trunk): test: use assert_not_*

nobu	2016-02-19 16:45:58 +0900 (Fri, 19 Feb 2016)

  New Revision: 53871

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53871

  Log:
    test: use assert_not_*

  Modified files:
    trunk/test/io/wait/test_io_wait.rb
    trunk/test/net/http/test_http.rb
    trunk/test/net/http/test_http_request.rb
    trunk/test/net/http/test_httpresponse.rb
    trunk/test/openssl/test_buffering.rb
    trunk/test/openssl/test_cipher.rb
    trunk/test/openssl/test_ssl.rb
    trunk/test/ruby/test_variable.rb
Index: test/net/http/test_http_request.rb
===================================================================
--- test/net/http/test_http_request.rb	(revision 53870)
+++ test/net/http/test_http_request.rb	(revision 53871)
@@ -9,8 +9,8 @@ class HTTPRequestTest < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http_request.rb#L9
     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::Test https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http_request.rb#L27
     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::Test https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http_request.rb#L43
     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::Test https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http_request.rb#L61
 
     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::Test https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http_request.rb#L72
 
     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
Index: test/net/http/test_httpresponse.rb
===================================================================
--- test/net/http/test_httpresponse.rb	(revision 53870)
+++ test/net/http/test_httpresponse.rb	(revision 53871)
@@ -323,7 +323,7 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/net/http/test_httpresponse.rb#L323
     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
Index: test/net/http/test_http.rb
===================================================================
--- test/net/http/test_http.rb	(revision 53870)
+++ test/net/http/test_http.rb	(revision 53871)
@@ -14,7 +14,7 @@ class TestNetHTTP < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L14
 
     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 https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L25
 
     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 https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L43
 
       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 https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L51
       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 https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L488
       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 https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L562
 
     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 https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L578
 
     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)
Index: test/io/wait/test_io_wait.rb
===================================================================
--- test/io/wait/test_io_wait.rb	(revision 53870)
+++ test/io/wait/test_io_wait.rb	(revision 53871)
@@ -37,16 +37,16 @@ class TestIOWait < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/io/wait/test_io_wait.rb#L37
   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
Index: test/ruby/test_variable.rb
===================================================================
--- test/ruby/test_variable.rb	(revision 53870)
+++ test/ruby/test_variable.rb	(revision 53871)
@@ -144,7 +144,7 @@ class TestVariable < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L144
       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)
Index: test/openssl/test_ssl.rb
===================================================================
--- test/openssl/test_ssl.rb	(revision 53870)
+++ test/openssl/test_ssl.rb	(revision 53871)
@@ -752,7 +752,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTes https://github.com/ruby/ruby/blob/trunk/test/openssl/test_ssl.rb#L752
 
     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"
Index: test/openssl/test_buffering.rb
===================================================================
--- test/openssl/test_buffering.rb	(revision 53870)
+++ test/openssl/test_buffering.rb	(revision 53871)
@@ -43,19 +43,19 @@ class OpenSSL::TestBuffering < Test::Uni https://github.com/ruby/ruby/blob/trunk/test/openssl/test_buffering.rb#L43
   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::Uni https://github.com/ruby/ruby/blob/trunk/test/openssl/test_buffering.rb#L66
       @io.flush
     end
 
-    refute @io.sync, 'sync must not change'
+    assert_not_predicate @io, :sync, 'sync must not change'
   end
 
   def test_getc
Index: test/openssl/test_cipher.rb
===================================================================
--- test/openssl/test_cipher.rb	(revision 53870)
+++ test/openssl/test_cipher.rb	(revision 53871)
@@ -143,9 +143,9 @@ class OpenSSL::TestCipher < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/openssl/test_cipher.rb#L143
 
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]