[Groonga-commit] groonga/groonga-query-log at c7709d5 [master] response-comparer: support sort_keys

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jun 13 09:50:06 JST 2018


Kouhei Sutou	2018-06-13 09:50:06 +0900 (Wed, 13 Jun 2018)

  New Revision: c7709d50a4271e3a0796a0241247a11433db99fb
  https://github.com/groonga/groonga-query-log/commit/c7709d50a4271e3a0796a0241247a11433db99fb

  Message:
    response-comparer: support sort_keys

  Modified files:
    lib/groonga-query-log/response-comparer.rb
    test/test-response-comparer.rb

  Modified: lib/groonga-query-log/response-comparer.rb (+1 -1)
===================================================================
--- lib/groonga-query-log/response-comparer.rb    2018-06-12 17:42:51 +0900 (52b3f7b)
+++ lib/groonga-query-log/response-comparer.rb    2018-06-13 09:50:06 +0900 (3792281)
@@ -95,7 +95,7 @@ module GroongaQueryLog
     end
 
     def score_sort?
-      sort_items = (@command.sortby || "").split(/\s*,\s*/)
+      sort_items =****@comma*****_keys
       normalized_sort_items = sort_items.collect do |item|
         item.gsub(/\A[+-]/, "")
       end

  Modified: test/test-response-comparer.rb (+22 -3)
===================================================================
--- test/test-response-comparer.rb    2018-06-12 17:42:51 +0900 (4124339)
+++ test/test-response-comparer.rb    2018-06-13 09:50:06 +0900 (742701d)
@@ -115,14 +115,33 @@ class ResponseComparerTest < Test::Unit::TestCase
       end
     end
 
-    class SortbyTest < self
+    class SortKeysTest < self
       class DetectScoreSortTest < self
         private
-        def score_sort?(sortby)
-          @command["sortby"] = sortby
+        def score_sort?(sort_keys)
+          @command[:sort_keys] = sort_keys
           comparer([[[0], []]], [[[0], []]]).send(:score_sort?)
         end
 
+        class ParameterNameTest < self
+          def score_sort?(parameter_name)
+            @command[parameter_name] = "_score"
+            comparer([[[0], []]], [[[0], []]]).send(:score_sort?)
+          end
+
+          def test_sortby
+            assert do
+              score_sort?(:sortby)
+            end
+          end
+
+          def test_sort_keys
+            assert do
+              score_sort?(:sort_keys)
+            end
+          end
+        end
+
         class NoScoreTest < self
           def test_nil
             assert_false(score_sort?(nil))
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180613/1ed5f583/attachment-0001.htm 



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