Tetsuro IKEDA
null+****@clear*****
Thu Oct 4 10:18:53 JST 2012
Tetsuro IKEDA 2009-06-23 19:12:55 +0900 (Tue, 23 Jun 2009) New Revision: 27ba4b31b4bb5cce602310d9014f3926e6c97712 https://github.com/mroonga/mroonga/commit/27ba4b31b4bb5cce602310d9014f3926e6c97712 Log: add test case for mrn_init. Modified files: src/Makefile.am test/Makefile.am test/unit/test-driver.c Renamed files: test/run-unit-test.sh (from test/unit-test.sh) Modified: src/Makefile.am (+1 -1) =================================================================== --- src/Makefile.am 2009-06-23 18:10:03 +0900 (5ef283e) +++ src/Makefile.am 2009-06-23 19:12:55 +0900 (69e5747) @@ -1,4 +1,4 @@ -AM_CPPFLAGS = $(MYSQL_INC) $(GROONGA_INCLUDES) $(MECAB_INCLUDES) $(CUTTER_CFLAGS) +AM_CPPFLAGS = $(MYSQL_INC) $(GROONGA_INCLUDES) $(MECAB_INCLUDES) AM_INCLUDES = -l. -l.. ACLOCAL_AMFLAGS = $$ACLOCAL_ARGS Modified: test/Makefile.am (+1 -1) =================================================================== --- test/Makefile.am 2009-06-23 18:10:03 +0900 (aa986e2) +++ test/Makefile.am 2009-06-23 19:12:55 +0900 (fe9e248) @@ -1,6 +1,6 @@ SUBDIRS = unit -TESTS = unit-test.sh +TESTS = run-unit-test.sh TESTS_ENVIRONMENT = CUTTER="$(CUTTER)" echo-cutter: Renamed: test/run-unit-test.sh (+0 -0) 100% =================================================================== Modified: test/unit/test-driver.c (+24 -4) =================================================================== --- test/unit/test-driver.c 2009-06-23 18:10:03 +0900 (059f92c) +++ test/unit/test-driver.c 2009-06-23 19:12:55 +0900 (d8a2495) @@ -1,10 +1,32 @@ -#include <cutter.h> +#include <gcutter.h> +#include <glib/gstdio.h> #include "driver.h" -void test_mrn_init() +static gchar *base_directory; +static gchar *tmp_directory; +static grn_ctx *ctx; + +void cut_startup() +{ + base_directory = g_get_current_dir(); + tmp_directory = g_build_filename(base_directory, "/tmp", NULL); + cut_remove_path(tmp_directory, NULL); + g_mkdir_with_parents(tmp_directory, 0700); + g_chdir(tmp_directory); + grn_init(); + grn_ctx_init(ctx,0); +} + +void cut_shutdown() { + grn_ctx_fin(ctx); grn_fin(); + g_chdir(base_directory); + g_free(tmp_directory); +} +void test_mrn_init() +{ mrn_db = NULL; mrn_hash = NULL; mrn_lexicon = NULL; @@ -13,6 +35,4 @@ void test_mrn_init() cut_assert_not_null(mrn_db); cut_assert_not_null(mrn_hash); cut_assert_not_null(mrn_lexicon); - - grn_fin(); } -------------- next part -------------- HTML����������������������������...Download