[Groonga-commit] ranguba/rroonga at f332b7c [master] test: add a test for Groonga::QueryLogger.reopen

Back to archive index

Kouhei Sutou null+****@clear*****
Thu May 14 18:27:17 JST 2015


Kouhei Sutou	2015-05-14 18:27:17 +0900 (Thu, 14 May 2015)

  New Revision: f332b7ca4ec5b8d16a557bf240af88362163c47d
  https://github.com/ranguba/rroonga/commit/f332b7ca4ec5b8d16a557bf240af88362163c47d

  Message:
    test: add a test for Groonga::QueryLogger.reopen

  Added files:
    test/test-query-logger.rb

  Added: test/test-query-logger.rb (+41 -0) 100644
===================================================================
--- /dev/null
+++ test/test-query-logger.rb    2015-05-14 18:27:17 +0900 (f73e329)
@@ -0,0 +1,41 @@
+# Copyright (C) 2015  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+class QueryLoggerTest < Test::Unit::TestCase
+  include GroongaTestUtils
+
+  def setup
+    @default_log_path = Groonga::QueryLogger.path
+  end
+
+  def teardown
+    Groonga::QueryLogger.path = @default_log_path
+  end
+
+  def test_reopen
+    Groonga::QueryLogger.unregister
+    Groonga::QueryLogger.path = @query_log_path.to_s
+    if @query_log_path.exist?
+      FileUtils.mv(@query_log_path, "#{@query_log_path}.old")
+    end
+    assert do
+      not @query_log_path.exist?
+    end
+    Groonga::QueryLogger.reopen
+    assert do
+      @query_log_path.exist?
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



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