[Groonga-commit] droonga/drntest at 4062028 [master] Support start-sorting and end-sorting directive

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 14 23:43:59 JST 2014


Kouhei Sutou	2014-07-14 23:43:59 +0900 (Mon, 14 Jul 2014)

  New Revision: 40620281cdb843e94c1b1d1e2c7f21aa01e0804d
  https://github.com/droonga/drntest/commit/40620281cdb843e94c1b1d1e2c7f21aa01e0804d

  Message:
    Support start-sorting and end-sorting directive

  Modified files:
    lib/drntest/directive.rb
    lib/drntest/test-executor.rb
    lib/drntest/test-loader.rb

  Modified: lib/drntest/directive.rb (+6 -0)
===================================================================
--- lib/drntest/directive.rb    2014-07-14 22:55:22 +0900 (0d600d7)
+++ lib/drntest/directive.rb    2014-07-14 23:43:59 +0900 (bcdb5cd)
@@ -55,4 +55,10 @@ module Drntest
       @version = version
     end
   end
+
+  class StartSortingDirective < Directive
+  end
+
+  class EndSortingDirective < Directive
+  end
 end

  Modified: lib/drntest/test-executor.rb (+15 -1)
===================================================================
--- lib/drntest/test-executor.rb    2014-07-14 22:55:22 +0900 (274de15)
+++ lib/drntest/test-executor.rb    2014-07-14 23:43:59 +0900 (78b460a)
@@ -62,6 +62,7 @@ module Drntest
         @requests = []
         @responses = []
         @logging = true
+        @sort_buffer = nil
       end
 
       def execute(operation)
@@ -97,13 +98,26 @@ module Drntest
             @results.omit(message)
             abort_execution
           end
+        when StartSortingDirective
+          @sort_buffer = []
+        when EndSortingDirective
+          sorted_responses = @sort_buffer.sort_by do |response|
+            response["type"]
+          end
+          @responses.concat(sorted_responses)
+          @sort_buffer = nil
         end
       end
 
       def execute_request(request)
         if @logging
           request_process =****@clien*****(request) do |raw_response|
-            @responses << clean_response(request, raw_response)
+            response = clean_response(request, raw_response)
+            if @sort_buffer
+              @sort_buffer << response
+            else
+              @responses << response
+            end
           end
           request_process.wait
         else

  Modified: lib/drntest/test-loader.rb (+4 -0)
===================================================================
--- lib/drntest/test-loader.rb    2014-07-14 22:55:22 +0900 (37ac725)
+++ lib/drntest/test-loader.rb    2014-07-14 23:43:59 +0900 (fe21870)
@@ -91,6 +91,10 @@ module Drntest
         OmitDirective.new(options.first)
       when :require_catalog_version
         RequireCatalogVersionDirective.new(Integer(options.first))
+      when :start_sorting
+        StartSortingDirective.new
+      when :end_sorting
+        EndSortingDirective.new
       else
         UnknownDirective.new(type, options)
       end
-------------- next part --------------
HTML����������������������������...
Download 



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