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

ruby-changes:36261

From: akr <ko1@a...>
Date: Sun, 9 Nov 2014 21:16:52 +0900 (JST)
Subject: [ruby-changes:36261] akr:r48342 (trunk): * test/webrick: Fix the argument order of assert_equal.

akr	2014-11-09 21:16:38 +0900 (Sun, 09 Nov 2014)

  New Revision: 48342

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

  Log:
    * test/webrick: Fix the argument order of assert_equal.

  Modified files:
    trunk/ChangeLog
    trunk/test/webrick/test_filehandler.rb
    trunk/test/webrick/test_httpserver.rb
    trunk/test/webrick/test_server.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48341)
+++ ChangeLog	(revision 48342)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov  9 21:03:59 2014  Tanaka Akira  <akr@f...>
+
+	* test/webrick: Fix the argument order of assert_equal.
+
 Sun Nov  9 20:29:01 2014  Tanaka Akira  <akr@f...>
 
 	* test/webrick: Store log in an array.
Index: test/webrick/test_httpserver.rb
===================================================================
--- test/webrick/test_httpserver.rb	(revision 48341)
+++ test/webrick/test_httpserver.rb	(revision 48342)
@@ -24,50 +24,50 @@ class TestWEBrickHTTPServer < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/webrick/test_httpserver.rb#L24
     serv, opts, script_name, path_info = httpd.search_servlet("/")
     assert_equal(:Root, serv)
     assert_equal([], opts)
-    assert_equal(script_name, "")
-    assert_equal(path_info, "/")
+    assert_equal("", script_name)
+    assert_equal("/", path_info)
 
     serv, opts, script_name, path_info = httpd.search_servlet("/sub")
     assert_equal(:Root, serv)
     assert_equal([], opts)
-    assert_equal(script_name, "")
-    assert_equal(path_info, "/sub")
+    assert_equal("", script_name)
+    assert_equal("/sub", path_info)
 
     serv, opts, script_name, path_info = httpd.search_servlet("/sub/")
     assert_equal(:Root, serv)
     assert_equal([], opts)
-    assert_equal(script_name, "")
-    assert_equal(path_info, "/sub/")
+    assert_equal("", script_name)
+    assert_equal("/sub/", path_info)
 
     serv, opts, script_name, path_info = httpd.search_servlet("/foo")
     assert_equal(:Foo, serv)
     assert_equal([], opts)
-    assert_equal(script_name, "/foo")
-    assert_equal(path_info, "")
+    assert_equal("/foo", script_name)
+    assert_equal("", path_info)
 
     serv, opts, script_name, path_info = httpd.search_servlet("/foo/")
     assert_equal(:Foo, serv)
     assert_equal([], opts)
-    assert_equal(script_name, "/foo")
-    assert_equal(path_info, "/")
+    assert_equal("/foo", script_name)
+    assert_equal("/", path_info)
 
     serv, opts, script_name, path_info = httpd.search_servlet("/foo/sub")
     assert_equal(:Foo, serv)
     assert_equal([], opts)
-    assert_equal(script_name, "/foo")
-    assert_equal(path_info, "/sub")
+    assert_equal("/foo", script_name)
+    assert_equal("/sub", path_info)
 
     serv, opts, script_name, path_info = httpd.search_servlet("/foo/bar")
     assert_equal(:Bar, serv)
     assert_equal([:bar1], opts)
-    assert_equal(script_name, "/foo/bar")
-    assert_equal(path_info, "")
+    assert_equal("/foo/bar", script_name)
+    assert_equal("", path_info)
 
     serv, opts, script_name, path_info = httpd.search_servlet("/foo/bar/baz")
     assert_equal(:Baz, serv)
     assert_equal([:baz1, :baz2], opts)
-    assert_equal(script_name, "/foo/bar/baz")
-    assert_equal(path_info, "")
+    assert_equal("/foo/bar/baz", script_name)
+    assert_equal("", path_info)
   end
 
   class Req
@@ -243,9 +243,9 @@ class TestWEBrickHTTPServer < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/webrick/test_httpserver.rb#L243
       server.virtual_host(WEBrick::HTTPServer.new(vhost_config))
 
       Thread.pass while server.status != :Running
-      assert_equal(started, 1, log.call)
-      assert_equal(stopped, 0, log.call)
-      assert_equal(accepted, 0, log.call)
+      assert_equal(1, started, log.call)
+      assert_equal(0, stopped, log.call)
+      assert_equal(0, accepted, log.call)
 
       http = Net::HTTP.new(addr, port)
       req = Net::HTTP::Get.new("/")
@@ -371,7 +371,7 @@ class TestWEBrickHTTPServer < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/webrick/test_httpserver.rb#L371
       http.request(req){|res| assert_equal("404", res.code, log.call)}
       assert_match(%r{:RequestHandler is deprecated, please use :RequestCallback$}, log.call, log.call)
     }
-    assert_equal(requested, 1)
+    assert_equal(1, requested)
   end
 
   def test_shutdown_with_busy_keepalive_connection
Index: test/webrick/test_server.rb
===================================================================
--- test/webrick/test_server.rb	(revision 48341)
+++ test/webrick/test_server.rb	(revision 48342)
@@ -46,7 +46,7 @@ class TestWEBrickServer < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/webrick/test_server.rb#L46
       server.start
     end
 
-    assert_equal(stopped, 1)
+    assert_equal(1, stopped)
     assert_equal(1, log.length)
     assert_match(/FATAL SignalException: SIGTERM/, log[0])
   end
@@ -60,16 +60,16 @@ class TestWEBrickServer < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/webrick/test_server.rb#L60
     }
     TestWEBrick.start_server(Echo, config){|server, addr, port, log|
       true while server.status != :Running
-      assert_equal(started, 1, log.call)
-      assert_equal(stopped, 0, log.call)
-      assert_equal(accepted, 0, log.call)
+      assert_equal(1, started, log.call)
+      assert_equal(0, stopped, log.call)
+      assert_equal(0, accepted, log.call)
       TCPSocket.open(addr, port){|sock| (sock << "foo\n").gets }
       TCPSocket.open(addr, port){|sock| (sock << "foo\n").gets }
       TCPSocket.open(addr, port){|sock| (sock << "foo\n").gets }
-      assert_equal(accepted, 3, log.call)
+      assert_equal(3, accepted, log.call)
     }
-    assert_equal(started, 1)
-    assert_equal(stopped, 1)
+    assert_equal(1, started)
+    assert_equal(1, stopped)
   end
 
   def test_daemon
Index: test/webrick/test_filehandler.rb
===================================================================
--- test/webrick/test_filehandler.rb	(revision 48341)
+++ test/webrick/test_filehandler.rb	(revision 48342)
@@ -51,27 +51,27 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L51
 
     res = make_range_response(filename, "bytes=#{filesize-100}-")
     assert_match(%r{^text/plain}, res["content-type"])
-    assert_equal(get_res_body(res).size, 100)
+    assert_equal(100, get_res_body(res).size)
 
     res = make_range_response(filename, "bytes=-100")
     assert_match(%r{^text/plain}, res["content-type"])
-    assert_equal(get_res_body(res).size, 100)
+    assert_equal(100, get_res_body(res).size)
 
     res = make_range_response(filename, "bytes=0-99")
     assert_match(%r{^text/plain}, res["content-type"])
-    assert_equal(get_res_body(res).size, 100)
+    assert_equal(100, get_res_body(res).size)
 
     res = make_range_response(filename, "bytes=100-199")
     assert_match(%r{^text/plain}, res["content-type"])
-    assert_equal(get_res_body(res).size, 100)
+    assert_equal(100, get_res_body(res).size)
 
     res = make_range_response(filename, "bytes=0-0")
     assert_match(%r{^text/plain}, res["content-type"])
-    assert_equal(get_res_body(res).size, 1)
+    assert_equal(1, get_res_body(res).size)
 
     res = make_range_response(filename, "bytes=-1")
     assert_match(%r{^text/plain}, res["content-type"])
-    assert_equal(get_res_body(res).size, 1)
+    assert_equal(1, get_res_body(res).size)
 
     res = make_range_response(filename, "bytes=0-0, -2")
     assert_match(%r{^multipart/byteranges}, res["content-type"])

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

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