Kouhei Sutou
null+****@clear*****
Tue Aug 28 09:08:07 JST 2018
Kouhei Sutou 2018-08-28 09:08:07 +0900 (Tue, 28 Aug 2018) Revision: 90cd71f1b3fed6d863b3ad15b0e1c1f5b4cd719c https://github.com/groonga/groonga/commit/90cd71f1b3fed6d863b3ad15b0e1c1f5b4cd719c Message: test: remove a needless test case It should be covered by test/command/. Removed files: test/unit/core/test-log.c Modified files: test/unit/core/Makefile.am Modified: test/unit/core/Makefile.am (+0 -1) =================================================================== --- test/unit/core/Makefile.am 2018-08-27 18:11:17 +0900 (35d1ed751) +++ test/unit/core/Makefile.am 2018-08-28 09:08:07 +0900 (aea15f1f1) @@ -37,7 +37,6 @@ noinst_LTLIBRARIES = \ test-function.la \ test-function-edit-distance.la \ test-store-ja.la \ - test-log.la \ test-log-level.la \ test-table-sort-key-from-str.la \ test-inspect.la \ Deleted: test/unit/core/test-log.c (+0 -153) 100644 =================================================================== --- test/unit/core/test-log.c 2018-08-27 18:11:17 +0900 (ae1cb8285) +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- c-basic-offset: 2; coding: utf-8 -*- */ -/* - Copyright (C) 2010 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 -*/ - -#include <gcutter.h> -#include <glib/gstdio.h> - -#include "../lib/grn-assertions.h" - -#include <grn_str.h> - -void test_invalid_char(void); - -static grn_logger_info *logger; -static gchar *tmp_directory; - -static grn_ctx *context; -static grn_obj *database; - -void -cut_startup(void) -{ - tmp_directory = g_build_filename(grn_test_get_tmp_dir(), - "log", - NULL); -} - -void -cut_shutdown(void) -{ - g_free(tmp_directory); -} - -static void -remove_tmp_directory(void) -{ - cut_remove_path(tmp_directory, NULL); -} - -void -cut_setup(void) -{ - const gchar *database_path; - - remove_tmp_directory(); - g_mkdir_with_parents(tmp_directory, 0700); - - logger = setup_grn_logger(); - - context = g_new0(grn_ctx, 1); - grn_ctx_init(context, 0); - - database_path = cut_build_path(tmp_directory, "database.groonga", NULL); - database = grn_db_create(context, database_path, NULL); -} - -void -cut_teardown(void) -{ - grn_obj_close(context, database); - grn_ctx_fin(context); - g_free(context); - - teardown_grn_logger(logger); - - remove_tmp_directory(); -} - -void -test_invalid_char(void) -{ - GList *log = NULL; - - assert_send_command("table_create Users TABLE_HASH_KEY ShortText"); - assert_send_command("column_create Users name COLUMN_SCALAR ShortText"); - assert_send_command("column_create Users desc COLUMN_SCALAR ShortText"); - grn_collect_logger_clear_messages(logger); - assert_send_command("load --table Users --input_type json\n" - "[\n" - "{\"name\": \"groonga\" @ \"desc\": \"search engine\"}\n" - "]\n"); - log = (GList *)grn_collect_logger_get_messages(logger); - cut_assert_equal_string("ignored invalid char('@') at", - g_list_nth_data(log, 0)); - cut_assert_equal_string("{\"name\": \"groonga\" @", - g_list_nth_data(log, 1)); - cut_assert_equal_string(" ^", - g_list_nth_data(log, 2)); -} - -void -test_no_key(void) -{ - GList *log = NULL; - - assert_send_command("table_create Users TABLE_HASH_KEY ShortText"); - assert_send_command("column_create Users desc COLUMN_SCALAR ShortText"); - grn_collect_logger_clear_messages(logger); - assert_send_command("load --table Users --input_type json\n" - "[\n" - "{\"info\": \"search engine\"}\n" - "]\n"); - log = (GList *)grn_collect_logger_get_messages(logger); - cut_assert_equal_string("neither _key nor _id is assigned", - g_list_nth_data(log, 0)); -} - -void -test_duplicated_key(void) -{ - GList *log = NULL; - - assert_send_command("table_create Users TABLE_HASH_KEY ShortText"); - assert_send_command("column_create Users desc COLUMN_SCALAR ShortText"); - grn_collect_logger_clear_messages(logger); - assert_send_command("load --table Users --input_type json\n" - "[\n" - "{\"_key\": \"groonga\", \"_id\": 1}\n" - "]\n"); - log = (GList *)grn_collect_logger_get_messages(logger); - cut_assert_equal_string("duplicated key columns: _key and _id", - g_list_nth_data(log, 0)); -} - -void -test_invalid_column(void) -{ - GList *log = NULL; - - assert_send_command("table_create Users TABLE_HASH_KEY ShortText"); - assert_send_command("column_create Users desc COLUMN_SCALAR ShortText"); - grn_collect_logger_clear_messages(logger); - assert_send_command("load --table Users --input_type json\n" - "[\n" - "{\"_key\": \"groonga\", \"info\": \"search engine\"}\n" - "]\n"); - log = (GList *)grn_collect_logger_get_messages(logger); - cut_assert_equal_string("invalid column('info')", g_list_nth_data(log, 0)); -} -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180828/b3c70e9b/attachment-0001.htm