From 1f83df7a18a9ac354e44ae422be85cfdc73c7c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 11 Oct 2021 00:02:49 +0200 Subject: irc: use parsed command parameters in "fail", "warn" and "note" command callbacks --- tests/unit/plugins/irc/test-irc-protocol.cpp | 32 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'tests/unit/plugins/irc') diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 037feeb9e..777012992 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -46,7 +46,8 @@ extern const char *irc_protocol_nick_address (struct t_irc_server *server, struct t_irc_nick *nick, const char *nickname, const char *address); -extern char *irc_protocol_string_params (const char **params, int start_arg); +extern char *irc_protocol_string_params (const char **params, + int arg_start, int arg_end); extern char *irc_protocol_cap_to_enable (const char *capabilities, int sasl_requested); } @@ -320,27 +321,30 @@ TEST(IrcProtocol, StringParams) const char *params_3[] = { "param1", "param2", "param3", NULL }; /* invalid arguments */ - WEE_TEST_STR("", irc_protocol_string_params (NULL, -1)); - WEE_TEST_STR("", irc_protocol_string_params (NULL, 0)); + WEE_TEST_STR("", irc_protocol_string_params (NULL, -1, -1)); + WEE_TEST_STR("", irc_protocol_string_params (NULL, 0, 0)); + WEE_TEST_STR("", irc_protocol_string_params (NULL, 0, -1)); + WEE_TEST_STR("", irc_protocol_string_params (params_1, 1, 0)); /* empty parameter */ - WEE_TEST_STR("", irc_protocol_string_params (params_empty, 0)); - WEE_TEST_STR("", irc_protocol_string_params (params_empty, 1)); + WEE_TEST_STR("", irc_protocol_string_params (params_empty, 0, 0)); + WEE_TEST_STR("", irc_protocol_string_params (params_empty, 1, 1)); /* one parameter */ - WEE_TEST_STR("param1", irc_protocol_string_params (params_1, 0)); - WEE_TEST_STR("", irc_protocol_string_params (params_1, 1)); + WEE_TEST_STR("param1", irc_protocol_string_params (params_1, 0, 0)); + WEE_TEST_STR("", irc_protocol_string_params (params_1, 1, 1)); /* two parameters */ - WEE_TEST_STR("param1 param2", irc_protocol_string_params (params_2, 0)); - WEE_TEST_STR("param2", irc_protocol_string_params (params_2, 1)); - WEE_TEST_STR("", irc_protocol_string_params (params_2, 2)); + WEE_TEST_STR("param1 param2", irc_protocol_string_params (params_2, 0, 1)); + WEE_TEST_STR("param2", irc_protocol_string_params (params_2, 1, 1)); + WEE_TEST_STR("", irc_protocol_string_params (params_2, 2, 2)); /* three parameters */ - WEE_TEST_STR("param1 param2 param3", irc_protocol_string_params (params_3, 0)); - WEE_TEST_STR("param2 param3", irc_protocol_string_params (params_3, 1)); - WEE_TEST_STR("param3", irc_protocol_string_params (params_3, 2)); - WEE_TEST_STR("", irc_protocol_string_params (params_3, 3)); + WEE_TEST_STR("param1 param2 param3", irc_protocol_string_params (params_3, 0, 2)); + WEE_TEST_STR("param2 param3", irc_protocol_string_params (params_3, 1, 2)); + WEE_TEST_STR("param2", irc_protocol_string_params (params_3, 1, 1)); + WEE_TEST_STR("param3", irc_protocol_string_params (params_3, 2, 2)); + WEE_TEST_STR("", irc_protocol_string_params (params_3, 3, 3)); } TEST_GROUP(IrcProtocolWithServer) -- cgit v1.2.3