[Groonga-commit] groonga/groonga-query-log at 6f62798 [master] test: follow API change

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 2 16:29:00 JST 2014


Kouhei Sutou	2014-06-02 16:29:00 +0900 (Mon, 02 Jun 2014)

  New Revision: 6f62798450a32765ddd2ed83afb6f227758ea853
  https://github.com/groonga/groonga-query-log/commit/6f62798450a32765ddd2ed83afb6f227758ea853

  Message:
    test: follow API change

  Modified files:
    test/test-analyzer.rb
    test/test-extractor.rb

  Modified: test/test-analyzer.rb (+1 -1)
===================================================================
--- test/test-analyzer.rb    2014-06-02 16:12:00 +0900 (c3dba4f)
+++ test/test-analyzer.rb    2014-06-02 16:29:00 +0900 (121d869)
@@ -85,7 +85,7 @@ class AnalyzerTest < Test::Unit::TestCase
   def run_analyzer(*arguments)
     Tempfile.open("output.actual") do |output|
       arguments << "--output" << output.path
-      @analyzer.run(*arguments)
+      @analyzer.run(arguments)
       File.read(output.path)
     end
   end

  Modified: test/test-extractor.rb (+24 -7)
===================================================================
--- test/test-extractor.rb    2014-06-02 16:12:00 +0900 (de70d9d)
+++ test/test-extractor.rb    2014-06-02 16:29:00 +0900 (d253a41)
@@ -45,9 +45,8 @@ EOC
     end
 
     def test_no_specified
-      assert_raise(Groonga::QueryLog::Extractor::NoInputError) do
-        run_extractor
-      end
+      assert_equal("Error: Please specify input log files.\n",
+                   run_extractor)
     end
   end
 
@@ -100,10 +99,28 @@ EOC
 
   private
   def run_extractor(*arguments)
-    Tempfile.open("extract.actual") do |output|
-      arguments << "--output" << output.path
-      @extractor.run(*arguments)
-      File.read(output.path)
+    Tempfile.open("extract.output") do |output|
+      open_error_output do |error|
+        arguments << "--output" << output.path
+        if****@extra*****(arguments)
+          File.read(output.path)
+        else
+          File.read(error.path)
+        end
+      end
+    end
+  end
+
+  def open_error_output
+    Tempfile.open("extract.error") do |error|
+      error.sync = true
+      original_stderr = $stderr.dup
+      $stderr.reopen(error)
+      begin
+        yield(error)
+      ensure
+        $stderr.reopen(original_stderr)
+      end
     end
   end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index