From 12a6f74ec01d9daa2e23dce5ab15b1ee3ce09006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 7 Aug 2018 21:50:04 +0200 Subject: [PATCH] core: fix check of tags in lines All changes: - fix check of tags in lines: check lines without tags, fix check of tags with negation ("!tag") - add string functions string_split_tags and string_free_split_tags - add tests on function gui_line_match_tags --- ChangeLog.adoc | 1 + src/core/wee-config.c | 36 ++------- src/core/wee-hook.c | 45 ++++------- src/core/wee-string.c | 67 ++++++++++++++++ src/core/wee-string.h | 2 + src/gui/gui-buffer.c | 78 +++--------------- src/gui/gui-filter.c | 38 ++------- src/gui/gui-line.c | 33 +++++--- src/gui/gui-line.h | 3 + tests/CMakeLists.txt | 1 + tests/Makefile.am | 1 + tests/tests.cpp | 24 +++--- tests/unit/core/test-arraylist.cpp | 4 +- tests/unit/core/test-eval.cpp | 10 +-- tests/unit/core/test-hashtable.cpp | 16 ++-- tests/unit/core/test-hdata.cpp | 16 ++-- tests/unit/core/test-infolist.cpp | 18 ++--- tests/unit/core/test-list.cpp | 18 ++--- tests/unit/core/test-string.cpp | 125 +++++++++++++++++++++-------- tests/unit/core/test-url.cpp | 6 +- tests/unit/core/test-utf8.cpp | 16 ++-- tests/unit/core/test-util.cpp | 18 ++--- tests/unit/gui/test-line.cpp | 81 +++++++++++++++++++ 23 files changed, 382 insertions(+), 275 deletions(-) create mode 100644 tests/unit/gui/test-line.cpp diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 36d052801..c2c272c3d 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -24,6 +24,7 @@ New features:: Bug fixes:: + * core: fix check of tags in lines (command /filter and hook_print) * core: fix clear of completion item in case of partial completion (issue #1162) * core: send signal "key_pressed" for mouse code only if the string is UTF-8 valid (issue #1220) * scripts: fix duplicated lines in output of script eval (python, perl, ruby, lua and guile) diff --git a/src/core/wee-config.c b/src/core/wee-config.c index c2ae20bc7..c2bb09d30 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -885,9 +885,6 @@ void config_change_highlight_tags (const void *pointer, void *data, struct t_config_option *option) { - int i; - char **tags_array; - /* make C compiler happy */ (void) pointer; (void) data; @@ -895,11 +892,7 @@ config_change_highlight_tags (const void *pointer, void *data, if (config_highlight_tags) { - for (i = 0; i < config_num_highlight_tags; i++) - { - string_free_split (config_highlight_tags[i]); - } - free (config_highlight_tags); + string_free_split_tags (config_highlight_tags); config_highlight_tags = NULL; } config_num_highlight_tags = 0; @@ -907,22 +900,9 @@ config_change_highlight_tags (const void *pointer, void *data, if (CONFIG_STRING(config_look_highlight_tags) && CONFIG_STRING(config_look_highlight_tags)[0]) { - tags_array = string_split (CONFIG_STRING(config_look_highlight_tags), - ",", 0, 0, &config_num_highlight_tags); - if (tags_array) - { - config_highlight_tags = malloc (config_num_highlight_tags * - sizeof (*config_highlight_tags)); - if (config_highlight_tags) - { - for (i = 0; i < config_num_highlight_tags; i++) - { - config_highlight_tags[i] = string_split (tags_array[i], - "+", 0, 0, NULL); - } - } - string_free_split (tags_array); - } + config_highlight_tags = string_split_tags ( + CONFIG_STRING(config_look_highlight_tags), + &config_num_highlight_tags); } } @@ -4618,8 +4598,6 @@ config_weechat_write () void config_weechat_free () { - int i; - config_file_free (weechat_config_file); if (config_highlight_regex) @@ -4631,11 +4609,7 @@ config_weechat_free () if (config_highlight_tags) { - for (i = 0; i < config_num_highlight_tags; i++) - { - string_free_split (config_highlight_tags[i]); - } - free (config_highlight_tags); + string_free_split_tags (config_highlight_tags); config_highlight_tags = NULL; } config_num_highlight_tags = 0; diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 8e83c0a8e..66be9451a 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -2419,8 +2419,6 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer, { struct t_hook *new_hook; struct t_hook_print *new_hook_print; - char **tags_array; - int i; if (!callback) return NULL; @@ -2441,28 +2439,8 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer, new_hook->hook_data = new_hook_print; new_hook_print->callback = callback; new_hook_print->buffer = buffer; - new_hook_print->tags_count = 0; - new_hook_print->tags_array = NULL; - if (tags) - { - tags_array = string_split (tags, ",", 0, 0, - &new_hook_print->tags_count); - if (tags_array) - { - new_hook_print->tags_array = malloc (new_hook_print->tags_count * - sizeof (*new_hook_print->tags_array)); - if (new_hook_print->tags_array) - { - for (i = 0; i < new_hook_print->tags_count; i++) - { - new_hook_print->tags_array[i] = string_split (tags_array[i], - "+", 0, 0, - NULL); - } - } - string_free_split (tags_array); - } - } + new_hook_print->tags_array = string_split_tags (tags, + &new_hook_print->tags_count); new_hook_print->message = (message) ? strdup (message) : NULL; new_hook_print->strip_colors = strip_colors; @@ -4016,11 +3994,7 @@ unhook (struct t_hook *hook) case HOOK_TYPE_PRINT: if (HOOK_PRINT(hook, tags_array)) { - for (i = 0; i < HOOK_PRINT(hook, tags_count); i++) - { - string_free_split (HOOK_PRINT(hook, tags_array)[i]); - } - free (HOOK_PRINT(hook, tags_array)); + string_free_split_tags (HOOK_PRINT(hook, tags_array)); HOOK_PRINT(hook, tags_array) = NULL; } if (HOOK_PRINT(hook, message)) @@ -4897,6 +4871,19 @@ hook_print_log () log_printf (" buffer. . . . . . . . : 0x%lx", HOOK_PRINT(ptr_hook, buffer)); log_printf (" tags_count. . . . . . : %d", HOOK_PRINT(ptr_hook, tags_count)); log_printf (" tags_array. . . . . . : 0x%lx", HOOK_PRINT(ptr_hook, tags_array)); + if (HOOK_PRINT(ptr_hook, tags_array)) + { + for (i = 0; i < HOOK_PRINT(ptr_hook, tags_count); i++) + { + for (j = 0; HOOK_PRINT(ptr_hook, tags_array)[i][j]; j++) + { + log_printf (" tags_array[%03d][%03d]: '%s'", + i, + j, + HOOK_PRINT(ptr_hook, tags_array)[i][j]); + } + } + } log_printf (" message . . . . . . . : '%s'", HOOK_PRINT(ptr_hook, message)); log_printf (" strip_colors. . . . . : %d", HOOK_PRINT(ptr_hook, strip_colors)); break; diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 6a2939da9..c79a59f43 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -2306,6 +2306,73 @@ string_free_split_command (char **split_command) } } +/* + * Splits tags in an array of tags. + * + * The format of tags is a list of tags separated by commas (logical OR), + * and for each item, multiple tags can be separated by "+" (logical AND). + * + * For example: + * irc_join + * irc_join,irc_quit + * irc_join+nick_toto,irc_quit + */ + +char *** +string_split_tags (const char *tags, int *num_tags) +{ + char ***tags_array, **tags_array_temp; + int i, tags_count; + + tags_array = NULL; + tags_count = 0; + + if (tags) + { + tags_array_temp = string_split (tags, ",", 0, 0, &tags_count); + if (tags_array_temp && (tags_count > 0)) + { + tags_array = malloc ((tags_count + 1) * sizeof (*tags_array)); + if (tags_array) + { + for (i = 0; i < tags_count; i++) + { + tags_array[i] = string_split_shared (tags_array_temp[i], + "+", 0, 0, + NULL); + } + tags_array[tags_count] = NULL; + } + } + if (tags_array_temp) + string_free_split (tags_array_temp); + } + + if (num_tags) + *num_tags = tags_count; + + return tags_array; +} + +/* + * Frees tags split. + */ + +void +string_free_split_tags (char ***split_tags) +{ + int i; + + if (split_tags) + { + for (i = 0; split_tags[i]; i++) + { + string_free_split_shared (split_tags[i]); + } + free (split_tags); + } +} + /* * Converts a string to another charset. * diff --git a/src/core/wee-string.h b/src/core/wee-string.h index 1679a33ad..d891b17dd 100644 --- a/src/core/wee-string.h +++ b/src/core/wee-string.h @@ -95,6 +95,8 @@ extern char *string_build_with_split_string (const char **split_string, const char *separator); extern char **string_split_command (const char *command, char separator); extern void string_free_split_command (char **split_command); +extern char ***string_split_tags (const char *tags, int *num_tags); +extern void string_free_split_tags (char ***split_tags); extern char *string_iconv (int from_utf8, const char *from_code, const char *to_code, const char *string); extern char *string_iconv_to_internal (const char *charset, const char *string); diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index db80180a4..8c4751752 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1629,9 +1629,6 @@ void gui_buffer_set_highlight_tags_restrict (struct t_gui_buffer *buffer, const char *new_tags) { - int i; - char **tags_array; - if (!buffer) return; @@ -1642,11 +1639,7 @@ gui_buffer_set_highlight_tags_restrict (struct t_gui_buffer *buffer, } if (buffer->highlight_tags_restrict_array) { - for (i = 0; i < buffer->highlight_tags_restrict_count; i++) - { - string_free_split (buffer->highlight_tags_restrict_array[i]); - } - free (buffer->highlight_tags_restrict_array); + string_free_split_tags (buffer->highlight_tags_restrict_array); buffer->highlight_tags_restrict_array = NULL; } buffer->highlight_tags_restrict_count = 0; @@ -1658,24 +1651,9 @@ gui_buffer_set_highlight_tags_restrict (struct t_gui_buffer *buffer, if (!buffer->highlight_tags_restrict) return; - tags_array = string_split (buffer->highlight_tags_restrict, ",", 0, 0, - &buffer->highlight_tags_restrict_count); - if (tags_array) - { - buffer->highlight_tags_restrict_array = - malloc (buffer->highlight_tags_restrict_count * - sizeof (*buffer->highlight_tags_restrict_array)); - if (buffer->highlight_tags_restrict_array) - { - for (i = 0; i < buffer->highlight_tags_restrict_count; i++) - { - buffer->highlight_tags_restrict_array[i] = string_split (tags_array[i], - "+", 0, 0, - NULL); - } - } - string_free_split (tags_array); - } + buffer->highlight_tags_restrict_array = string_split_tags ( + buffer->highlight_tags_restrict, + &buffer->highlight_tags_restrict_count); } /* @@ -1686,9 +1664,6 @@ void gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer, const char *new_tags) { - int i; - char **tags_array; - if (!buffer) return; @@ -1699,11 +1674,7 @@ gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer, } if (buffer->highlight_tags_array) { - for (i = 0; i < buffer->highlight_tags_count; i++) - { - string_free_split (buffer->highlight_tags_array[i]); - } - free (buffer->highlight_tags_array); + string_free_split_tags (buffer->highlight_tags_array); buffer->highlight_tags_array = NULL; } buffer->highlight_tags_count = 0; @@ -1715,24 +1686,9 @@ gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer, if (!buffer->highlight_tags) return; - tags_array = string_split (buffer->highlight_tags, ",", 0, 0, - &buffer->highlight_tags_count); - if (tags_array) - { - buffer->highlight_tags_array = - malloc (buffer->highlight_tags_count * - sizeof (*buffer->highlight_tags_array)); - if (buffer->highlight_tags_array) - { - for (i = 0; i < buffer->highlight_tags_count; i++) - { - buffer->highlight_tags_array[i] = string_split (tags_array[i], - "+", 0, 0, - NULL); - } - } - string_free_split (tags_array); - } + buffer->highlight_tags_array = string_split_tags ( + buffer->highlight_tags, + &buffer->highlight_tags_count); } /* @@ -2717,7 +2673,7 @@ gui_buffer_close (struct t_gui_buffer *buffer) struct t_gui_window *ptr_window; struct t_gui_buffer *ptr_buffer, *ptr_back_to_buffer; struct t_gui_buffer *ptr_buffer_visited_buffer; - int index, i; + int index; struct t_gui_buffer_visited *ptr_buffer_visited; if (!buffer) @@ -2877,23 +2833,11 @@ gui_buffer_close (struct t_gui_buffer *buffer) if (buffer->highlight_tags_restrict) free (buffer->highlight_tags_restrict); if (buffer->highlight_tags_restrict_array) - { - for (i = 0; i < buffer->highlight_tags_restrict_count; i++) - { - string_free_split (buffer->highlight_tags_restrict_array[i]); - } - free (buffer->highlight_tags_restrict_array); - } + string_free_split_tags (buffer->highlight_tags_restrict_array); if (buffer->highlight_tags) free (buffer->highlight_tags); if (buffer->highlight_tags_array) - { - for (i = 0; i < buffer->highlight_tags_count; i++) - { - string_free_split (buffer->highlight_tags_array[i]); - } - free (buffer->highlight_tags_array); - } + string_free_split_tags (buffer->highlight_tags_array); if (buffer->input_callback_data) free (buffer->input_callback_data); if (buffer->close_callback_data) diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index ed2de8259..0ef5edb97 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -281,9 +281,9 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name, { struct t_gui_filter *new_filter; regex_t *regex1, *regex2; - char *pos_tab, *regex_prefix, **tags_array, buf[512], str_error[512]; + char *pos_tab, *regex_prefix, buf[512], str_error[512]; const char *ptr_start_regex, *pos_regex_message; - int i, rc; + int rc; if (!name || !buffer_name || !tags || !regex) { @@ -389,28 +389,8 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name, ",", 0, 0, &new_filter->num_buffers); new_filter->tags = (tags) ? strdup (tags) : NULL; - new_filter->tags_count = 0; - new_filter->tags_array = NULL; - if (new_filter->tags) - { - tags_array = string_split (new_filter->tags, ",", 0, 0, - &new_filter->tags_count); - if (tags_array) - { - new_filter->tags_array = malloc (new_filter->tags_count * - sizeof (*new_filter->tags_array)); - if (new_filter->tags_array) - { - for (i = 0; i < new_filter->tags_count; i++) - { - new_filter->tags_array[i] = string_split (tags_array[i], - "+", 0, 0, - NULL); - } - } - string_free_split (tags_array); - } - } + new_filter->tags_array = string_split_tags (new_filter->tags, + &new_filter->tags_count); new_filter->regex = strdup (regex); new_filter->regex_prefix = regex1; new_filter->regex_message = regex2; @@ -465,8 +445,6 @@ gui_filter_rename (struct t_gui_filter *filter, const char *new_name) void gui_filter_free (struct t_gui_filter *filter) { - int i; - if (!filter) return; @@ -483,13 +461,7 @@ gui_filter_free (struct t_gui_filter *filter) if (filter->tags) free (filter->tags); if (filter->tags_array) - { - for (i = 0; i < filter->tags_count; i++) - { - string_free_split (filter->tags_array[i]); - } - free (filter->tags_array); - } + string_free_split_tags (filter->tags_array); if (filter->regex) free (filter->regex); if (filter->regex_prefix) diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index 7b4894c29..fd7677198 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -604,35 +604,44 @@ gui_line_match_tags (struct t_gui_line_data *line_data, int tags_count, char ***tags_array) { int i, j, k, match, tag_found, tag_negated; + const char *ptr_tag; if (!line_data) return 0; - if (line_data->tags_count == 0) - return 0; - for (i = 0; i < tags_count; i++) { match = 1; for (j = 0; tags_array[i][j]; j++) { + ptr_tag = tags_array[i][j]; tag_found = 0; tag_negated = 0; /* check if tag is negated (prefixed with a '!') */ - if ((tags_array[i][j][0] == '!') && tags_array[i][j][1]) - tag_negated = 1; - - for (k = 0; k < line_data->tags_count; k++) + if ((ptr_tag[0] == '!') && ptr_tag[1]) { - if (string_match (line_data->tags_array[k], - (tag_negated) ? tags_array[i][j] + 1 : tags_array[i][j], - 0)) + ptr_tag++; + tag_negated = 1; + } + + if (strcmp (ptr_tag, "*") == 0) + { + tag_found = 1; + } + else + { + for (k = 0; k < line_data->tags_count; k++) { - tag_found = 1; - break; + if (string_match (line_data->tags_array[k], ptr_tag, 0)) + { + tag_found = 1; + break; + } } } + if (tag_found && tag_negated) + return 0; if ((!tag_found && !tag_negated) || (tag_found && tag_negated)) { match = 0; diff --git a/src/gui/gui-line.h b/src/gui/gui-line.h index a57d59ae3..4d8b4cca1 100644 --- a/src/gui/gui-line.h +++ b/src/gui/gui-line.h @@ -70,6 +70,9 @@ struct t_gui_lines extern struct t_gui_lines *gui_lines_alloc (); extern void gui_lines_free (struct t_gui_lines *lines); +extern void gui_line_tags_alloc (struct t_gui_line_data *line_data, + const char *tags); +extern void gui_line_tags_free (struct t_gui_line_data *line_data); extern void gui_line_get_prefix_for_display (struct t_gui_line *line, char **prefix, int *length, char **color, int *prefix_is_nick); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8e87d894f..b90720498 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -35,6 +35,7 @@ set(LIB_WEECHAT_UNIT_TESTS_SRC unit/core/test-url.cpp unit/core/test-utf8.cpp unit/core/test-util.cpp + unit/gui/test-line.cpp scripts/test-scripts.cpp ) add_library(weechat_unit_tests STATIC ${LIB_WEECHAT_UNIT_TESTS_SRC}) diff --git a/tests/Makefile.am b/tests/Makefile.am index a1cc51044..f90031d4c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,6 +32,7 @@ lib_weechat_unit_tests_a_SOURCES = unit/test-plugins.cpp \ unit/core/test-url.cpp \ unit/core/test-utf8.cpp \ unit/core/test-util.cpp \ + unit/gui/test-line.cpp \ scripts/test-scripts.cpp noinst_PROGRAMS = tests diff --git a/tests/tests.cpp b/tests/tests.cpp index 8a6e7cc5c..0bb898f9d 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -53,17 +53,21 @@ extern "C" #define WEECHAT_TESTS_HOME "./tmp_weechat_test" /* import tests from libs */ +/* core */ IMPORT_TEST_GROUP(Plugins); -IMPORT_TEST_GROUP(Arraylist); -IMPORT_TEST_GROUP(Eval); -IMPORT_TEST_GROUP(Hashtable); -IMPORT_TEST_GROUP(Hdata); -IMPORT_TEST_GROUP(Infolist); -IMPORT_TEST_GROUP(List); -IMPORT_TEST_GROUP(String); -IMPORT_TEST_GROUP(Url); -IMPORT_TEST_GROUP(Utf8); -IMPORT_TEST_GROUP(Util); +IMPORT_TEST_GROUP(CoreArraylist); +IMPORT_TEST_GROUP(CoreEval); +IMPORT_TEST_GROUP(CoreHashtable); +IMPORT_TEST_GROUP(CoreHdata); +IMPORT_TEST_GROUP(CoreInfolist); +IMPORT_TEST_GROUP(CoreList); +IMPORT_TEST_GROUP(CoreString); +IMPORT_TEST_GROUP(CoreUrl); +IMPORT_TEST_GROUP(CoreUtf8); +IMPORT_TEST_GROUP(CoreUtil); +/* GUI */ +IMPORT_TEST_GROUP(GuiLine); +/* scripts */ IMPORT_TEST_GROUP(Scripts); struct t_gui_buffer *ptr_core_buffer = NULL; diff --git a/tests/unit/core/test-arraylist.cpp b/tests/unit/core/test-arraylist.cpp index 8277ac7b4..7b34d5bb8 100644 --- a/tests/unit/core/test-arraylist.cpp +++ b/tests/unit/core/test-arraylist.cpp @@ -47,7 +47,7 @@ extern "C" LONGS_EQUAL(__result_index, index); \ LONGS_EQUAL(__result_index_insert, index_insert); -TEST_GROUP(Arraylist) +TEST_GROUP(CoreArraylist) { }; @@ -477,7 +477,7 @@ test_arraylist (int initial_size, int sorted, int allow_duplicates) * arraylist_free */ -TEST(Arraylist, New) +TEST(CoreArraylist, New) { int initial_size, sorted, allow_duplicates; diff --git a/tests/unit/core/test-eval.cpp b/tests/unit/core/test-eval.cpp index 6cc4ce54c..7fa22969d 100644 --- a/tests/unit/core/test-eval.cpp +++ b/tests/unit/core/test-eval.cpp @@ -41,7 +41,7 @@ extern "C" STRCMP_EQUAL(__result, value); \ free (value); -TEST_GROUP(Eval) +TEST_GROUP(CoreEval) { }; @@ -50,7 +50,7 @@ TEST_GROUP(Eval) * eval_is_true */ -TEST(Eval, Boolean) +TEST(CoreEval, Boolean) { /* false */ LONGS_EQUAL(0, eval_is_true (NULL)); @@ -69,7 +69,7 @@ TEST(Eval, Boolean) * eval_expression (condition) */ -TEST(Eval, EvalCondition) +TEST(CoreEval, EvalCondition) { struct t_hashtable *pointers, *extra_vars, *options; char *value; @@ -218,7 +218,7 @@ TEST(Eval, EvalCondition) * eval_expression (expression) */ -TEST(Eval, EvalExpression) +TEST(CoreEval, EvalExpression) { struct t_hashtable *pointers, *extra_vars, *options; struct t_config_option *ptr_option; @@ -427,7 +427,7 @@ TEST(Eval, EvalExpression) * eval_expression (replace with regex) */ -TEST(Eval, EvalReplaceRegex) +TEST(CoreEval, EvalReplaceRegex) { struct t_hashtable *pointers, *extra_vars, *options; char *value; diff --git a/tests/unit/core/test-hashtable.cpp b/tests/unit/core/test-hashtable.cpp index f25117f17..8cc985a96 100644 --- a/tests/unit/core/test-hashtable.cpp +++ b/tests/unit/core/test-hashtable.cpp @@ -32,7 +32,7 @@ extern "C" #define HASHTABLE_TEST_KEY_HASH 5849825121ULL #define HASHTABLE_TEST_VALUE "this is a value" -TEST_GROUP(Hashtable) +TEST_GROUP(CoreHashtable) { }; @@ -41,7 +41,7 @@ TEST_GROUP(Hashtable) * hashtable_hash_key_djb2 */ -TEST(Hashtable, HashDbj2) +TEST(CoreHashtable, HashDbj2) { unsigned long long hash; @@ -85,7 +85,7 @@ test_hashtable_keycmp_cb (struct t_hashtable *hashtable, * hashtable_new */ -TEST(Hashtable, New) +TEST(CoreHashtable, New) { struct t_hashtable *hashtable; @@ -138,7 +138,7 @@ TEST(Hashtable, New) * hashtable_free */ -TEST(Hashtable, SetGetRemove) +TEST(CoreHashtable, SetGetRemove) { struct t_hashtable *hashtable, *hashtable2; struct t_hashtable_item *item, *ptr_item, *ptr_item2; @@ -338,7 +338,7 @@ TEST(Hashtable, SetGetRemove) * hashtable_map_string */ -TEST(Hashtable, Map) +TEST(CoreHashtable, Map) { /* TODO: write tests */ } @@ -351,7 +351,7 @@ TEST(Hashtable, Map) * hashtable_set_pointer */ -TEST(Hashtable, Properties) +TEST(CoreHashtable, Properties) { /* TODO: write tests */ } @@ -362,7 +362,7 @@ TEST(Hashtable, Properties) * hashtable_add_from_infolist */ -TEST(Hashtable, Infolist) +TEST(CoreHashtable, Infolist) { /* TODO: write tests */ } @@ -372,7 +372,7 @@ TEST(Hashtable, Infolist) * hashtable_print_log */ -TEST(Hashtable, PrintLog) +TEST(CoreHashtable, PrintLog) { /* TODO: write tests */ } diff --git a/tests/unit/core/test-hdata.cpp b/tests/unit/core/test-hdata.cpp index 4a7ff306f..65e342a94 100644 --- a/tests/unit/core/test-hdata.cpp +++ b/tests/unit/core/test-hdata.cpp @@ -26,7 +26,7 @@ extern "C" #include "src/core/wee-hdata.h" } -TEST_GROUP(Hdata) +TEST_GROUP(CoreHdata) { }; @@ -37,7 +37,7 @@ TEST_GROUP(Hdata) * hdata_new_list */ -TEST(Hdata, New) +TEST(CoreHdata, New) { /* TODO: write tests */ } @@ -55,7 +55,7 @@ TEST(Hdata, New) * hdata_get_list */ -TEST(Hdata, Get) +TEST(CoreHdata, Get) { /* TODO: write tests */ } @@ -65,7 +65,7 @@ TEST(Hdata, Get) * hdata_check_pointer */ -TEST(Hdata, Check) +TEST(CoreHdata, Check) { /* TODO: write tests */ } @@ -76,7 +76,7 @@ TEST(Hdata, Check) * hdata_search */ -TEST(Hdata, Move) +TEST(CoreHdata, Move) { /* TODO: write tests */ } @@ -91,7 +91,7 @@ TEST(Hdata, Move) * hdata_time */ -TEST(Hdata, Read) +TEST(CoreHdata, Read) { /* TODO: write tests */ } @@ -102,7 +102,7 @@ TEST(Hdata, Read) * hdata_free_all */ -TEST(Hdata, Free) +TEST(CoreHdata, Free) { /* TODO: write tests */ } @@ -112,7 +112,7 @@ TEST(Hdata, Free) * hdata_print_log */ -TEST(Hdata, PrintLog) +TEST(CoreHdata, PrintLog) { /* TODO: write tests */ } diff --git a/tests/unit/core/test-infolist.cpp b/tests/unit/core/test-infolist.cpp index f93587704..443b54c71 100644 --- a/tests/unit/core/test-infolist.cpp +++ b/tests/unit/core/test-infolist.cpp @@ -31,7 +31,7 @@ extern "C" struct t_hook *hook_test_infolist = NULL; -TEST_GROUP(Infolist) +TEST_GROUP(CoreInfolist) { /* * Callback for the infolist used in tests. @@ -113,7 +113,7 @@ TEST_GROUP(Infolist) * infolist_new_var_time */ -TEST(Infolist, New) +TEST(CoreInfolist, New) { struct t_infolist *infolist; struct t_infolist_item *item; @@ -240,7 +240,7 @@ TEST(Infolist, New) * infolist_free */ -TEST(Infolist, Valid) +TEST(CoreInfolist, Valid) { struct t_infolist *infolist; @@ -260,7 +260,7 @@ TEST(Infolist, Valid) * infolist_search_var */ -TEST(Infolist, Search) +TEST(CoreInfolist, Search) { struct t_infolist *infolist; struct t_infolist_item *ptr_item; @@ -306,7 +306,7 @@ TEST(Infolist, Search) * infolist_reset_item_cursor */ -TEST(Infolist, Move) +TEST(CoreInfolist, Move) { struct t_infolist *infolist; @@ -350,7 +350,7 @@ TEST(Infolist, Move) * infolist_get */ -TEST(Infolist, Get) +TEST(CoreInfolist, Get) { struct t_infolist *infolist; struct t_infolist_var *ptr_var; @@ -404,7 +404,7 @@ TEST(Infolist, Get) * infolist_time */ -TEST(Infolist, GetValues) +TEST(CoreInfolist, GetValues) { struct t_infolist *infolist; void *ptr_buffer; @@ -434,7 +434,7 @@ TEST(Infolist, GetValues) * infolist_fields */ -TEST(Infolist, Fields) +TEST(CoreInfolist, Fields) { struct t_infolist *infolist; const char *fields1 = "i:integer,s:string,p:pointer,b:buffer,t:time"; @@ -463,7 +463,7 @@ TEST(Infolist, Fields) * infolist_print_log */ -TEST(Infolist, PrintLog) +TEST(CoreInfolist, PrintLog) { /* TODO: write tests */ } diff --git a/tests/unit/core/test-list.cpp b/tests/unit/core/test-list.cpp index 93e1c54c4..b81f0091f 100644 --- a/tests/unit/core/test-list.cpp +++ b/tests/unit/core/test-list.cpp @@ -31,7 +31,7 @@ extern "C" #define LIST_VALUE_XYZ "xyz" #define LIST_VALUE_ZZZ "zzz" -TEST_GROUP(List) +TEST_GROUP(CoreList) { }; @@ -58,7 +58,7 @@ test_list_new () * weelist_new */ -TEST(List, New) +TEST(CoreList, New) { struct t_weelist *list; @@ -80,7 +80,7 @@ TEST(List, New) * weelist_free */ -TEST(List, Add) +TEST(CoreList, Add) { struct t_weelist *list; struct t_weelist_item *item1, *item2, *item3; @@ -145,7 +145,7 @@ TEST(List, Add) * weelist_casesearch_pos */ -TEST(List, Search) +TEST(CoreList, Search) { struct t_weelist *list; struct t_weelist_item *ptr_item; @@ -233,7 +233,7 @@ TEST(List, Search) * weelist_string */ -TEST(List, Get) +TEST(CoreList, Get) { struct t_weelist *list; struct t_weelist_item *ptr_item; @@ -282,7 +282,7 @@ TEST(List, Get) * weelist_set */ -TEST(List, Set) +TEST(CoreList, Set) { struct t_weelist *list; struct t_weelist_item *ptr_item; @@ -310,7 +310,7 @@ TEST(List, Set) * weelist_prev */ -TEST(List, Move) +TEST(CoreList, Move) { struct t_weelist *list; struct t_weelist_item *ptr_item; @@ -347,7 +347,7 @@ TEST(List, Move) * weelist_remove_all */ -TEST(List, Free) +TEST(CoreList, Free) { struct t_weelist *list; struct t_weelist_item *ptr_item; @@ -386,7 +386,7 @@ TEST(List, Free) * weelist_print_log */ -TEST(List, PrintLog) +TEST(CoreList, PrintLog) { /* TODO: write tests */ } diff --git a/tests/unit/core/test-string.cpp b/tests/unit/core/test-string.cpp index 302a4b648..c1f19798c 100644 --- a/tests/unit/core/test-string.cpp +++ b/tests/unit/core/test-string.cpp @@ -107,7 +107,7 @@ extern "C" extern struct t_hashtable *string_hashtable_shared; -TEST_GROUP(String) +TEST_GROUP(CoreString) { }; @@ -116,7 +116,7 @@ TEST_GROUP(String) * string_strndup */ -TEST(String, Duplicate) +TEST(CoreString, Duplicate) { const char *str_test = "test"; char *str; @@ -150,7 +150,7 @@ TEST(String, Duplicate) * string_toupper */ -TEST(String, Case) +TEST(CoreString, Case) { char *str; @@ -169,7 +169,7 @@ TEST(String, Case) * string_cut */ -TEST(String, Cut) +TEST(CoreString, Cut) { POINTERS_EQUAL(NULL, string_cut (NULL, 0, 0, 0, NULL)); STRCMP_EQUAL("", string_cut ("", 0, 0, 0, NULL)); @@ -273,7 +273,7 @@ TEST(String, Cut) * string_reverse */ -TEST(String, Reverse) +TEST(CoreString, Reverse) { POINTERS_EQUAL(NULL, string_reverse (NULL)); STRCMP_EQUAL("", string_reverse ("")); @@ -301,7 +301,7 @@ TEST(String, Reverse) * string_strcmp_ignore_chars */ -TEST(String, Comparison) +TEST(CoreString, Comparison) { /* case-insensitive comparison */ LONGS_EQUAL(0, string_strcasecmp (NULL, NULL)); @@ -406,7 +406,7 @@ TEST(String, Comparison) * string_strcasestr */ -TEST(String, Search) +TEST(CoreString, Search) { const char *str = "test"; @@ -425,7 +425,7 @@ TEST(String, Search) * string_match */ -TEST(String, Match) +TEST(CoreString, Match) { LONGS_EQUAL(0, string_match (NULL, NULL, 0)); LONGS_EQUAL(0, string_match (NULL, "test", 0)); @@ -478,7 +478,7 @@ TEST(String, Match) * string_expand_home */ -TEST(String, ExpandHome) +TEST(CoreString, ExpandHome) { char *home, *result; int length_home; @@ -500,7 +500,7 @@ TEST(String, ExpandHome) * string_eval_path_home */ -TEST(String, EvalPathHome) +TEST(CoreString, EvalPathHome) { char *home, *result; int length_home, length_weechat_home; @@ -560,7 +560,7 @@ TEST(String, EvalPathHome) * string_remove_quotes */ -TEST(String, RemoveQuotes) +TEST(CoreString, RemoveQuotes) { char *str; @@ -584,7 +584,7 @@ TEST(String, RemoveQuotes) * string_strip */ -TEST(String, Strip) +TEST(CoreString, Strip) { char *str; @@ -603,7 +603,7 @@ TEST(String, Strip) * string_convert_escaped_chars */ -TEST(String, ConvertEscapedChars) +TEST(CoreString, ConvertEscapedChars) { char *str; @@ -640,7 +640,7 @@ TEST(String, ConvertEscapedChars) * string_is_word_char_input */ -TEST(String, IsWordChar) +TEST(CoreString, IsWordChar) { WEE_IS_WORD_CHAR(0, NULL); WEE_IS_WORD_CHAR(0, ""); @@ -665,7 +665,7 @@ TEST(String, IsWordChar) * string_mask_to_regex */ -TEST(String, MaskToRegex) +TEST(CoreString, MaskToRegex) { char *str; @@ -685,7 +685,7 @@ TEST(String, MaskToRegex) * string_regcomp */ -TEST(String, Regex) +TEST(CoreString, Regex) { int flags; const char *ptr; @@ -746,7 +746,7 @@ TEST(String, Regex) * string_has_highlight_regex */ -TEST(String, Highlight) +TEST(CoreString, Highlight) { regex_t regex; @@ -818,7 +818,7 @@ test_replace_cb (void *data, const char *text) * string_replace */ -TEST(String, Replace) +TEST(CoreString, Replace) { char *str; @@ -841,7 +841,7 @@ TEST(String, Replace) * string_replace_regex */ -TEST(String, ReplaceRegex) +TEST(CoreString, ReplaceRegex) { regex_t regex; char *result; @@ -865,7 +865,7 @@ TEST(String, ReplaceRegex) * string_replace_with_callback */ -TEST(String, ReplaceWithCallback) +TEST(CoreString, ReplaceWithCallback) { char *result; const char *list_prefix_no_replace[] = { "no_replace:", NULL }; @@ -926,7 +926,7 @@ TEST(String, ReplaceWithCallback) * string_free_split */ -TEST(String, Split) +TEST(CoreString, Split) { char **argv; int argc; @@ -1016,7 +1016,7 @@ TEST(String, Split) * string_free_split_shared */ -TEST(String, SplitShared) +TEST(CoreString, SplitShared) { char **argv; int argc; @@ -1049,7 +1049,7 @@ TEST(String, SplitShared) * string_free_split */ -TEST(String, SplitShell) +TEST(CoreString, SplitShell) { char **argv; int argc; @@ -1086,7 +1086,7 @@ TEST(String, SplitShell) * string_free_split_command */ -TEST(String, SplitCommand) +TEST(CoreString, SplitCommand) { char **argv; @@ -1132,12 +1132,73 @@ TEST(String, SplitCommand) string_free_split_command (NULL); } +/* + * Tests functions: + * string_split_tags + * string_free_split_tags + */ + +TEST(CoreString, SplitTags) +{ + char ***tags; + int num_tags; + + /* test with a NULL/empty string */ + POINTERS_EQUAL(NULL, string_split_tags (NULL, NULL)); + POINTERS_EQUAL(NULL, string_split_tags ("", NULL)); + num_tags = -1; + POINTERS_EQUAL(NULL, string_split_tags (NULL, &num_tags)); + LONGS_EQUAL(0, num_tags); + num_tags = -1; + POINTERS_EQUAL(NULL, string_split_tags ("", &num_tags)); + LONGS_EQUAL(0, num_tags); + + /* string with one tag */ + num_tags = -1; + tags = string_split_tags ("irc_join", &num_tags); + CHECK(tags); + LONGS_EQUAL(1, num_tags); + STRCMP_EQUAL("irc_join", tags[0][0]); + POINTERS_EQUAL(NULL, tags[0][1]); + string_free_split_tags (tags); + + /* string with OR on 2 tags */ + num_tags = -1; + tags = string_split_tags ("irc_join,irc_quit", &num_tags); + CHECK(tags); + LONGS_EQUAL(2, num_tags); + STRCMP_EQUAL("irc_join", tags[0][0]); + POINTERS_EQUAL(NULL, tags[0][1]); + STRCMP_EQUAL("irc_quit", tags[1][0]); + POINTERS_EQUAL(NULL, tags[1][1]); + string_free_split_tags (tags); + + /* + * string with OR on: + * - 1 tag + * - AND on 2 tags + */ + num_tags = -1; + tags = string_split_tags ("irc_join,irc_quit+nick_test", &num_tags); + CHECK(tags); + LONGS_EQUAL(2, num_tags); + STRCMP_EQUAL("irc_join", tags[0][0]); + POINTERS_EQUAL(NULL, tags[0][1]); + STRCMP_EQUAL("irc_quit", tags[1][0]); + STRCMP_EQUAL("nick_test", tags[1][1]); + POINTERS_EQUAL(NULL, tags[1][2]); + string_free_split_tags (tags); + + /* free split with NULL */ + string_free_split_tags (NULL); +} + /* * Tests functions: * string_build_with_split_string */ -TEST(String, SplitBuildWithSplitString) +TEST(CoreString, SplitBuildWithSplitString) { char **argv, *str; int argc; @@ -1170,7 +1231,7 @@ TEST(String, SplitBuildWithSplitString) * string_fprintf */ -TEST(String, Iconv) +TEST(CoreString, Iconv) { const char *noel_utf8 = "no\xc3\xabl"; /* noël */ const char *noel_iso = "no\xebl"; @@ -1211,7 +1272,7 @@ TEST(String, Iconv) * string_format_size */ -TEST(String, FormatSize) +TEST(CoreString, FormatSize) { char *str; @@ -1251,7 +1312,7 @@ TEST(String, FormatSize) * string_decode_base64 */ -TEST(String, BaseN) +TEST(CoreString, BaseN) { char str[1024]; const char *str_base64[][2] = @@ -1334,7 +1395,7 @@ TEST(String, BaseN) * string_hex_dump */ -TEST(String, Hex_dump) +TEST(CoreString, Hex_dump) { const char *noel_utf8 = "no\xc3\xabl"; /* noël */ const char *noel_iso = "no\xebl"; @@ -1405,7 +1466,7 @@ TEST(String, Hex_dump) * string_input_for_buffer */ -TEST(String, Input) +TEST(CoreString, Input) { char *str; @@ -1452,7 +1513,7 @@ TEST(String, Input) * string_shared_free */ -TEST(String, Shared) +TEST(CoreString, Shared) { const char *str1, *str2, *str3; int count; @@ -1495,7 +1556,7 @@ TEST(String, Shared) * string_dyn_free */ -TEST(String, Dyn) +TEST(CoreString, Dyn) { char **str, *str_ptr; struct t_string_dyn *ptr_string_dyn; diff --git a/tests/unit/core/test-url.cpp b/tests/unit/core/test-url.cpp index 7f04f17a0..064b22c7b 100644 --- a/tests/unit/core/test-url.cpp +++ b/tests/unit/core/test-url.cpp @@ -26,7 +26,7 @@ extern "C" #include "src/core/wee-url.h" } -TEST_GROUP(Url) +TEST_GROUP(CoreUrl) { }; @@ -35,7 +35,7 @@ TEST_GROUP(Url) * weeurl_download */ -TEST(Url, Download) +TEST(CoreUrl, Download) { /* TODO: write tests */ } @@ -45,7 +45,7 @@ TEST(Url, Download) * weeurl_option_add_to_infolist */ -TEST(Url, AddToInfolist) +TEST(CoreUrl, AddToInfolist) { /* TODO: write tests */ } diff --git a/tests/unit/core/test-utf8.cpp b/tests/unit/core/test-utf8.cpp index 435de65ce..3c8b65395 100644 --- a/tests/unit/core/test-utf8.cpp +++ b/tests/unit/core/test-utf8.cpp @@ -38,7 +38,7 @@ const char *noel_invalid2_norm = "no??l"; const char *han_char = "\xf0\xa4\xad\xa2"; /* U+24B62 */ const char *han_char_z = "\xf0\xa4\xad\xa2Z"; -TEST_GROUP(Utf8) +TEST_GROUP(CoreUtf8) { }; @@ -48,7 +48,7 @@ TEST_GROUP(Utf8) * utf8_is_valid */ -TEST(Utf8, Validity) +TEST(CoreUtf8, Validity) { char *error; @@ -206,7 +206,7 @@ TEST(Utf8, Validity) * utf8_normalize */ -TEST(Utf8, Normalize) +TEST(CoreUtf8, Normalize) { char *str; @@ -231,7 +231,7 @@ TEST(Utf8, Normalize) * utf8_pos */ -TEST(Utf8, Move) +TEST(CoreUtf8, Move) { const char *ptr; @@ -278,7 +278,7 @@ TEST(Utf8, Move) * utf8_wide_char */ -TEST(Utf8, Convert) +TEST(CoreUtf8, Convert) { char result[5]; @@ -338,7 +338,7 @@ TEST(Utf8, Convert) * utf8_strlen_screen */ -TEST(Utf8, Size) +TEST(CoreUtf8, Size) { /* char size */ LONGS_EQUAL(0, utf8_char_size (NULL)); @@ -389,7 +389,7 @@ TEST(Utf8, Size) * utf8_charcasecmp_range */ -TEST(Utf8, Comparison) +TEST(CoreUtf8, Comparison) { /* case-sensitive comparison */ LONGS_EQUAL(0, utf8_charcmp (NULL, NULL)); @@ -435,7 +435,7 @@ TEST(Utf8, Comparison) * utf8_strndup */ -TEST(Utf8, Duplicate) +TEST(CoreUtf8, Duplicate) { char *str; diff --git a/tests/unit/core/test-util.cpp b/tests/unit/core/test-util.cpp index b099110d0..94756f721 100644 --- a/tests/unit/core/test-util.cpp +++ b/tests/unit/core/test-util.cpp @@ -30,7 +30,7 @@ extern "C" #include "src/core/wee-util.h" } -TEST_GROUP(Util) +TEST_GROUP(CoreUtil) { }; @@ -41,7 +41,7 @@ TEST_GROUP(Util) * util_timeval_add */ -TEST(Util, Timeval) +TEST(CoreUtil, Timeval) { struct timeval tv_zero = { 0, 0 }; struct timeval tv1 = { 123456, 12000 }; @@ -83,7 +83,7 @@ TEST(Util, Timeval) * util_get_time_string */ -TEST(Util, GetTimeString) +TEST(CoreUtil, GetTimeString) { time_t date; const char *str_date; @@ -99,7 +99,7 @@ TEST(Util, GetTimeString) * util_catch_signal */ -TEST(Util, Signal) +TEST(CoreUtil, Signal) { /* TODO: write tests */ } @@ -111,7 +111,7 @@ TEST(Util, Signal) * util_mkdir_parents */ -TEST(Util, Mkdir) +TEST(CoreUtil, Mkdir) { /* TODO: write tests */ } @@ -121,7 +121,7 @@ TEST(Util, Mkdir) * util_exec_on_files */ -TEST(Util, ExecOnFiles) +TEST(CoreUtil, ExecOnFiles) { /* TODO: write tests */ } @@ -131,7 +131,7 @@ TEST(Util, ExecOnFiles) * util_search_full_lib_name */ -TEST(Util, LibName) +TEST(CoreUtil, LibName) { /* TODO: write tests */ } @@ -141,7 +141,7 @@ TEST(Util, LibName) * util_file_get_content */ -TEST(Util, FileGetContent) +TEST(CoreUtil, FileGetContent) { /* TODO: write tests */ } @@ -151,7 +151,7 @@ TEST(Util, FileGetContent) * util_version_number */ -TEST(Util, VersionNumber) +TEST(CoreUtil, VersionNumber) { BYTES_EQUAL(0x00030200, util_version_number ("0.3.2-dev")); BYTES_EQUAL(0x00030200, util_version_number ("0.3.2-rc1")); diff --git a/tests/unit/gui/test-line.cpp b/tests/unit/gui/test-line.cpp new file mode 100644 index 000000000..856c4435f --- /dev/null +++ b/tests/unit/gui/test-line.cpp @@ -0,0 +1,81 @@ +/* + * test-eval.cpp - test evaluation functions + * + * Copyright (C) 2018 Sébastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see . + */ + +#include "CppUTest/TestHarness.h" + +extern "C" +{ +#include "src/core/wee-string.h" +#include "src/gui/gui-line.h" +} + +#define WEE_LINE_MATCH_TAGS(__result, __line_tags, __tags) \ + gui_line_tags_alloc (&line_data, __line_tags); \ + tags_array = string_split_tags (__tags, &tags_count); \ + LONGS_EQUAL(__result, gui_line_match_tags (&line_data, tags_count, \ + tags_array)); \ + gui_line_tags_free (&line_data); \ + string_free_split_tags (tags_array); + +TEST_GROUP(GuiLine) +{ +}; + +/* + * Tests functions: + * gui_line_match_tags + */ + +TEST(GuiLine, LineMatchTags) +{ + struct t_gui_line_data line_data; + char ***tags_array; + int tags_count; + + /* line without tags */ + WEE_LINE_MATCH_TAGS(0, NULL, NULL); + WEE_LINE_MATCH_TAGS(0, NULL, "irc_join"); + WEE_LINE_MATCH_TAGS(0, NULL, "!*"); + WEE_LINE_MATCH_TAGS(1, NULL, "!irc_join"); + WEE_LINE_MATCH_TAGS(1, NULL, "*"); + + /* line with one tag */ + WEE_LINE_MATCH_TAGS(0, "irc_join", NULL); + WEE_LINE_MATCH_TAGS(0, "irc_join", "irc_quit"); + WEE_LINE_MATCH_TAGS(0, "irc_join", "!*"); + WEE_LINE_MATCH_TAGS(1, "irc_join", "irc_join,irc_quit"); + WEE_LINE_MATCH_TAGS(1, "irc_join", "*"); + WEE_LINE_MATCH_TAGS(1, "irc_join", "irc_quit,*"); + + /* line with two tags */ + WEE_LINE_MATCH_TAGS(0, "irc_join,nick_test", NULL); + WEE_LINE_MATCH_TAGS(0, "irc_join,nick_test", "irc_quit"); + WEE_LINE_MATCH_TAGS(0, "irc_join,nick_test", "irc_part,irc_quit"); + WEE_LINE_MATCH_TAGS(0, "irc_join,nick_test", "irc_join+nick_xxx,irc_quit"); + WEE_LINE_MATCH_TAGS(0, "irc_join,nick_test", "!irc_join,!irc_quit"); + WEE_LINE_MATCH_TAGS(1, "irc_join,nick_test", "*"); + WEE_LINE_MATCH_TAGS(1, "irc_join,nick_test", "irc_quit,*"); + WEE_LINE_MATCH_TAGS(1, "irc_join,nick_test", "!irc_quit"); + WEE_LINE_MATCH_TAGS(1, "irc_join,nick_test", "irc_join+nick_test,irc_quit"); + WEE_LINE_MATCH_TAGS(1, "irc_join,nick_test", "nick_test,irc_quit"); + WEE_LINE_MATCH_TAGS(1, "irc_join,nick_test", "!irc_quit,!irc_302,!irc_notice"); + WEE_LINE_MATCH_TAGS(1, "irc_join,nick_test", "!irc_quit+!irc_302+!irc_notice"); +}