[Groonga-commit] ranguba/rroonga at a3df7ac [master] test: escape special path character

アーカイブの一覧に戻る
Kouhei Sutou null+****@clear*****
Fri May 10 18:05:32 JST 2019


Kouhei Sutou	2019-05-10 18:05:32 +0900 (Fri, 10 May 2019)

  Revision: a3df7ac83674c787568f10cacb9bddd39d04199f
  https://github.com/ranguba/rroonga/commit/a3df7ac83674c787568f10cacb9bddd39d04199f

  Message:
    test: escape special path character

  Modified files:
    test/groonga-test-utils.rb

  Modified: test/groonga-test-utils.rb (+7 -1)
===================================================================
--- test/groonga-test-utils.rb    2019-05-10 18:03:02 +0900 (0cf9cdb0)
+++ test/groonga-test-utils.rb    2019-05-10 18:05:32 +0900 (0d50b5f8)
@@ -44,7 +44,7 @@ module GroongaTestUtils
     setup_context
 
     @database = nil
-    name_for_path = name.gsub(/[\(\)\[\] ]/, "-")
+    name_for_path = escape_path(name)
     @database_path = @tmp_dir + "#{name_for_path}.db"
   end
 
@@ -155,6 +155,12 @@ module GroongaTestUtils
                  actual.expression.inspect)
   end
 
+  def escape_path(path)
+    path.gsub(/[: ?!\(\)\[\]]/) do
+      "_"
+    end
+  end
+
   def linux?
     /linux/ =~ RUBY_PLATFORM
   end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190510/21ffd1cb/attachment.html>


More information about the Groonga-commit mailing list
アーカイブの一覧に戻る