[Groonga-commit] groonga/groonga-query-log [master] test: don't replace $stdout for debugging

Back to archive index

Haruka Yoshihara null+****@clear*****
Thu Dec 13 17:58:33 JST 2012


Haruka Yoshihara	2012-12-13 17:58:33 +0900 (Thu, 13 Dec 2012)

  New Revision: 0b54af10f885bf51d2266e3f112bd18ece034f12
  https://github.com/groonga/groonga-query-log/commit/0b54af10f885bf51d2266e3f112bd18ece034f12

  Log:
    test: don't replace $stdout for debugging

  Modified files:
    test/test-analyzer.rb

  Modified: test/test-analyzer.rb (+3 -12)
===================================================================
--- test/test-analyzer.rb    2012-12-13 17:43:13 +0900 (58028cc)
+++ test/test-analyzer.rb    2012-12-13 17:58:33 +0900 (50d92fa)
@@ -28,21 +28,10 @@ class AnalyzerTest < Test::Unit::TestCase
     @query_log_path = File.join(@fixture_path, "query.log")
   end
 
-  setup
-  def setup_stdout
-    @output = StringIO.new
-    @original_stdout = $stdout.dup
-    $stdout = @output
-  end
-
   def setup
     @analyzer = Groonga::QueryLog::Analyzer.new
   end
 
-  def teardown
-    $stdout = @original_stdout
-  end
-
   data(:console => "console", :html => "html", :json => "json")
   def test_output(output_type)
     actual_result = run_analyzer("--reporter", output_type, @query_log_path)
@@ -60,8 +49,10 @@ class AnalyzerTest < Test::Unit::TestCase
 
   private
   def run_analyzer(*arguments)
+    @output = Tempfile.new("output.actual").path
+    arguments << "--output" << @output
     @analyzer.run(*arguments)
-    @output.string
+    File.read(@output)
   end
 
   def normalize_json(json_string)
-------------- next part --------------
HTML����������������������������...
Download 



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