Navigation Menu

Skip to content

Commit

Permalink
test: support not only query optimizer but also mruby written plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 7, 2015
1 parent 8c16dc2 commit 3d61ac3
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -168,7 +168,7 @@ CMakeFiles
/test/command/run-test.sh.log
/test/command/run-test.sh.trs
/test/command/test-suite.log
/test/query_optimizer/rroonga.built
/test/query_optimizer/groonga.pc
/test/mruby/rroonga.built
/test/mruby/groonga.pc
/*.tar.gz
/tmp
4 changes: 2 additions & 2 deletions .gitmodules
Expand Up @@ -4,6 +4,6 @@
[submodule "vendor/onigmo-source"]
path = vendor/onigmo-source
url = https://github.com/k-takata/Onigmo.git
[submodule "test/query_optimizer/rroonga"]
path = test/query_optimizer/rroonga
[submodule "test/mruby/rroonga"]
path = test/mruby/rroonga
url = https://github.com/ranguba/rroonga.git
33 changes: 33 additions & 0 deletions test/mruby/helper.rb
@@ -0,0 +1,33 @@
require "fileutils"

require "test-unit"

require_relative "helper/sandbox"
require_relative "helper/expression"

class GroongaTestCase < Test::Unit::TestCase
include Sandbox
include Expression

setup :setup_sandbox, :before => :prepend
teardown :teardown_sandbox, :after => :append
end

class QueryOptimizerTestCase < GroongaTestCase
def dump_plan(text, options={})
parse(text, options)
@expression.dump_plan
end
end

class ExpressionRewriterTestCase < GroongaTestCase
def dump_rewritten_plan(text, options={})
parse(text, options)
rewritten_expression = @expression.rewrite
if rewritten_expression
rewritten_expression.dump_plan
else
nil
end
end
end
@@ -1,4 +1,4 @@
module QueryOptimizer
module Expression
def setup_expression(domain)
@expression = Groonga::Expression.new
@expression.define_variable(:domain => domain)
Expand All @@ -14,9 +14,4 @@ def parse(text, options={})
}
@expression.parse(text, default_options.merge(options))
end

def dump_plan(text, options={})
parse(text, options)
@expression.dump_plan
end
end
File renamed without changes.
1 change: 1 addition & 0 deletions test/mruby/rroonga
Submodule rroonga added at e0a28f
Expand Up @@ -8,7 +8,7 @@
base_dir_path = Pathname(__FILE__).dirname
source_top_dir_path = base_dir_path.parent.parent
build_top_dir_path = current_dir_path
build_base_dir_path = build_top_dir_path + "test/query_optimizer"
build_base_dir_path = build_top_dir_path + "test/mruby"

Dir.chdir(build_top_dir_path.to_s) do
system("make -j8 > /dev/null") or exit(false)
Expand Down
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions test/query_optimizer/helper.rb

This file was deleted.

1 change: 0 additions & 1 deletion test/query_optimizer/rroonga
Submodule rroonga deleted from 69cdff

0 comments on commit 3d61ac3

Please sign in to comment.