Kouhei Sutou
null+****@clear*****
Tue Dec 17 22:30:03 JST 2013
Kouhei Sutou 2013-12-17 22:30:03 +0900 (Tue, 17 Dec 2013) New Revision: 8b17b4ffb5e6c1e9666e320cafa947320160036f https://github.com/droonga/drntest/commit/8b17b4ffb5e6c1e9666e320cafa947320160036f Message: Use "operation" for each directive and JSON in test file Modified files: lib/drntest/test-executor.rb lib/drntest/test-loader.rb Modified: lib/drntest/test-executor.rb (+7 -7) =================================================================== --- lib/drntest/test-executor.rb 2013-12-17 22:26:08 +0900 (8ad2550) +++ lib/drntest/test-executor.rb 2013-12-17 22:30:03 +0900 (fb1edfd) @@ -33,9 +33,9 @@ module Drntest client = Droonga::Client.open(tag: owner.tag, port: owner.port) do |client| requests = [] - test_commands.each do |test_command| - if test_command.is_a?(TestLoader::Directive) - case test_command.type + operations.each do |operation| + if operation.is_a?(TestLoader::Directive) + case operation.type when :enable_logging logging = true requests.each do |request| @@ -48,10 +48,10 @@ module Drntest next end if logging - response = client.connection.execute(test_command) - actuals << normalize_response(test_command, response) + response = client.connection.execute(operation) + actuals << normalize_response(operation, response) else - requests << client.connection.execute(test_command, + requests << client.connection.execute(operation, :connect_timeout => 2) do end end @@ -69,7 +69,7 @@ module Drntest normalizer.normalize end - def test_commands + def operations loader = TestLoader.new(@owner, @test_path) loader.load end Modified: lib/drntest/test-loader.rb (+7 -7) =================================================================== --- lib/drntest/test-loader.rb 2013-12-17 22:26:08 +0900 (16f273e) +++ lib/drntest/test-loader.rb 2013-12-17 22:30:03 +0900 (56619e1) @@ -37,9 +37,9 @@ module Drntest def load_test_file(path) parser = Yajl::Parser.new - objects = [] - parser.on_parse_complete = lambda do |object| - objects << object + operations = [] + parser.on_parse_complete = lambda do |operation| + operations << operation end data = "" Pathname(path).read.each_line do |line| @@ -49,10 +49,10 @@ module Drntest directive = Directive.new(line) if directive.type == :include included = resolve_relative_path(directive.value) - included_objects = load_test_file(included) - objects += included_objects + included_operations = load_test_file(included) + operations += included_operations else - objects << directive + operations << directive end end else @@ -64,7 +64,7 @@ module Drntest end end end - objects + operations end class Directive -------------- next part -------------- HTML����������������������������... ダウンロード