[Groonga-commit] ranguba/gqtp at 36a9ef1 [master] Indent

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jan 7 15:24:46 JST 2014


Kouhei Sutou	2014-01-07 15:24:46 +0900 (Tue, 07 Jan 2014)

  New Revision: 36a9ef11e77a8813f6c2dbbd6318be0832465593
  https://github.com/ranguba/gqtp/commit/36a9ef11e77a8813f6c2dbbd6318be0832465593

  Message:
    Indent

  Modified files:
    test/test-client.rb

  Modified: test/test-client.rb (+58 -58)
===================================================================
--- test/test-client.rb    2014-01-07 15:24:35 +0900 (eb28aa0)
+++ test/test-client.rb    2014-01-07 15:24:46 +0900 (c1cd38c)
@@ -22,81 +22,81 @@ require "gqtp/client"
 
 class ClientTest < Test::Unit::TestCase
   class RequestTest < self
-  def setup
-    @address = "127.0.0.1"
-    @server = TCPServer.new(@address, 0)
-    @port =****@serve*****[1]
+    def setup
+      @address = "127.0.0.1"
+      @server = TCPServer.new(@address, 0)
+      @port =****@serve*****[1]
 
-    @request_body = nil
-    @response_body = nil
-    @thread = Thread.new do
-      client =****@serve*****
-      @server.close
+      @request_body = nil
+      @response_body = nil
+      @thread = Thread.new do
+        client =****@serve*****
+        @server.close
 
-      process_client(client)
+        process_client(client)
 
-      client.close
+        client.close
+      end
     end
-  end
-
-  def teardown
-    @thread.kill
-  end
 
-  def test_sync
-    @response_body = "[false]"
-    client = GQTP::Client.new(:address => @address, :port => @port)
-    client.send("status")
-    header, body = client.read
-    assert_equal(["status",      @response_body.bytesize, @response_body],
-                 [@request_body, header.size,             body])
-  end
+    def teardown
+      @thread.kill
+    end
 
-  def test_async
-    @response_body = "[false]"
-    client = GQTP::Client.new(:address => @address, :port => @port)
-    request = client.send("status") do |header, body|
+    def test_sync
+      @response_body = "[false]"
+      client = GQTP::Client.new(:address => @address, :port => @port)
+      client.send("status")
+      header, body = client.read
       assert_equal(["status",      @response_body.bytesize, @response_body],
                    [@request_body, header.size,             body])
     end
-    request.wait
-  end
 
-  def test_unknown_connection
-    assert_raise(ArgumentError.new("unknown connection: <\"unknown\">")) do
-      GQTP::Client.new(:connection => "unknown")
+    def test_async
+      @response_body = "[false]"
+      client = GQTP::Client.new(:address => @address, :port => @port)
+      request = client.send("status") do |header, body|
+        assert_equal(["status",      @response_body.bytesize, @response_body],
+                     [@request_body, header.size,             body])
+      end
+      request.wait
     end
-  end
 
-  private
-  def process_client(client)
-    header = GQTP::Header.parse(client.read(GQTP::Header.size))
-    @request_body = client.read(header.size)
+    def test_unknown_connection
+      assert_raise(ArgumentError.new("unknown connection: <\"unknown\">")) do
+        GQTP::Client.new(:connection => "unknown")
+      end
+    end
 
-    response_header = GQTP::Header.new
-    response_header.size = @response_body.bytesize
-    client.write(response_header.pack)
-    client.write(@response_body)
-  end
+    private
+    def process_client(client)
+      header = GQTP::Header.parse(client.read(GQTP::Header.size))
+      @request_body = client.read(header.size)
 
-  class CloseTest < self
-    def test_sync
-      @response_body = "[]"
-      client = GQTP::Client.new(:address => @address, :port => @port)
-      assert_true(client.close)
+      response_header = GQTP::Header.new
+      response_header.size = @response_body.bytesize
+      client.write(response_header.pack)
+      client.write(@response_body)
     end
 
-    def test_async
-      @response_body = "[]"
-      client = GQTP::Client.new(:address => @address, :port => @port)
-      closed = false
-      close_request = client.close do
-        closed = true
+    class CloseTest < self
+      def test_sync
+        @response_body = "[]"
+        client = GQTP::Client.new(:address => @address, :port => @port)
+        assert_true(client.close)
+      end
+
+      def test_async
+        @response_body = "[]"
+        client = GQTP::Client.new(:address => @address, :port => @port)
+        closed = false
+        close_request = client.close do
+          closed = true
+        end
+        assert_false(closed)
+        close_request.wait
+        assert_true(closed)
       end
-      assert_false(closed)
-      close_request.wait
-      assert_true(closed)
     end
   end
-  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index