[Groonga-commit] groonga/groonga-query-log at 4bd90ae [master] Accept "_" as accessor name

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Sep 13 22:34:45 JST 2018


Kouhei Sutou	2018-09-13 22:34:45 +0900 (Thu, 13 Sep 2018)

  Revision: 4bd90ae12e899d9a8088f3ae49448d147ed95187
  https://github.com/groonga/groonga-query-log/commit/4bd90ae12e899d9a8088f3ae49448d147ed95187

  Message:
    Accept "_" as accessor name

  Modified files:
    lib/groonga-query-log/filter-rewriter.rb
    test/test-filter-rewriter.rb

  Modified: lib/groonga-query-log/filter-rewriter.rb (+1 -1)
===================================================================
--- lib/groonga-query-log/filter-rewriter.rb    2018-09-13 14:49:16 +0900 (7af9f41)
+++ lib/groonga-query-log/filter-rewriter.rb    2018-09-13 22:34:45 +0900 (60f695a)
@@ -32,7 +32,7 @@ module GroongaQueryLog
 
     private
     def rewrite_vector_equal(filter)
-      filter.gsub(/([a-zA-Z0-9.]+) *==/) do |matched|
+      filter.gsub(/([a-zA-Z0-9_.]+) *==/) do |matched|
         variable = $1
         if @vector_accessors.include?(variable)
           "#{variable} @"

  Modified: test/test-filter-rewriter.rb (+7 -1)
===================================================================
--- test/test-filter-rewriter.rb    2018-09-13 14:49:16 +0900 (64fd967)
+++ test/test-filter-rewriter.rb    2018-09-13 22:34:45 +0900 (79c1b74)
@@ -25,7 +25,7 @@ class FilterRewriterTest < Test::Unit::TestCase
     def rewrite_vector_equal(filter, vector_accessors)
       rewrite(filter,
               :rewrite_vector_equal => true,
-              :vector_accssors => vector_accessors)
+              :vector_accessors => vector_accessors)
     end
 
     def test_not_target_accessor
@@ -39,5 +39,11 @@ class FilterRewriterTest < Test::Unit::TestCase
                    rewrite_vector_equal("((vector == \"value\"))",
                                         ["vector"]))
     end
+
+    def test_under_score
+      assert_equal("vector_column @ \"value\"",
+                   rewrite_vector_equal("vector_column == \"value\"",
+                                        ["vector_column"]))
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180913/ae11f2c7/attachment-0001.htm 



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