Skip to content

Commit

Permalink
test: escape special path character
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed May 10, 2019
1 parent accf615 commit a3df7ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/groonga-test-utils.rb
Expand Up @@ -44,7 +44,7 @@ def setup_sandbox
setup_context

@database = nil
name_for_path = name.gsub(/[\(\)\[\] ]/, "-")
name_for_path = escape_path(name)
@database_path = @tmp_dir + "#{name_for_path}.db"
end

Expand Down Expand Up @@ -155,6 +155,12 @@ def assert_equal_select_result(expected, actual, &normalizer)
actual.expression.inspect)
end

def escape_path(path)
path.gsub(/[: ?!\(\)\[\]]/) do
"_"
end
end

def linux?
/linux/ =~ RUBY_PLATFORM
end
Expand Down

0 comments on commit a3df7ac

Please sign in to comment.