null+****@clear*****
null+****@clear*****
2010年 11月 23日 (火) 17:18:31 JST
Kouhei Sutou 2010-11-23 08:18:31 +0000 (Tue, 23 Nov 2010) New Revision: eb75bd12fc059ff3e1b2c948ce205fd05c302d0e Log: split shereable code. Modified files: test/unit/lib/ruby/groonga-test-utils.rb Modified: test/unit/lib/ruby/groonga-test-utils.rb (+8 -3) =================================================================== --- test/unit/lib/ruby/groonga-test-utils.rb 2010-11-23 08:16:47 +0000 (ba1228b) +++ test/unit/lib/ruby/groonga-test-utils.rb 2010-11-23 08:18:31 +0000 (d458e18) @@ -145,13 +145,12 @@ module GroongaTestUtils LANG_ENVS = %w"LANG LC_ALL LC_CTYPE" - def invoke_groonga(*args) + def invoke_command(*args) options = args.last.is_a?(Hash) ? args.pop : {} input_data = options[:input] || "" capture_output = options[:capture_output] capture_output = true if capture_output.nil? capture_error = options[:capture_error] - @groonga ||= guess_groonga_path args = [args] unless args.kind_of?(Array) begin in_child, in_parent = IO.pipe @@ -175,7 +174,7 @@ module GroongaTestUtils err_parent.close end Process.setrlimit(Process::RLIMIT_CORE, 0) rescue nil - exec(@groonga, *args) + exec(*args) end in_child.close out_child.close if capture_output @@ -204,6 +203,12 @@ module GroongaTestUtils return stdout, stderr, status end + def invoke_groonga(*args) + @groonga ||= guess_groonga_path + args.unshift(@groonga) + invoke_command(*args) + end + def assert_run_groonga(test_stdout, test_stderr, args, *rest) argnum = rest.size + 3 options = (Hash === rest.last ? rest.pop : {})