From 10b2fa3a6180dec90ccd4dab58fd750dcdf80f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 31 Mar 2023 19:52:34 +0200 Subject: irc: fix target buffer for commands 432/433 when the nickname looks like a channel --- tests/unit/plugins/irc/test-irc-protocol.cpp | 43 +++++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index d3c3efe6e..ad83803ae 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -3865,7 +3865,7 @@ TEST(IrcProtocolWithServer, 432_not_connected) TEST(IrcProtocolWithServer, 432_connected) { - SRV_INIT; + SRV_INIT_JOIN; /* not enough parameters */ RECV(":server 432"); @@ -3873,12 +3873,19 @@ TEST(IrcProtocolWithServer, 432_connected) RECV(":server 432 alice"); CHECK_ERROR_PARAMS("432", 1, 2); - RECV(":server 432 * alice"); - CHECK_SRV("-- * alice"); - RECV(":server 432 * alice error"); - CHECK_SRV("-- * alice error"); - RECV(":server 432 * alice :Erroneous Nickname"); - CHECK_SRV("-- * alice Erroneous Nickname"); + RECV(":server 432 alice test%+"); + CHECK_SRV("-- test%+"); + RECV(":server 432 alice test%+ error"); + CHECK_SRV("-- test%+: error"); + RECV(":server 432 alice test%+ :Erroneous Nickname"); + CHECK_SRV("-- test%+: Erroneous Nickname"); + + /* + * special case: erroneous nick is a channel: check that the message is + * still displayed on the server buffer + */ + RECV(":server 432 alice #test :Erroneous Nickname"); + CHECK_SRV("-- #test: Erroneous Nickname"); } /* @@ -3908,7 +3915,7 @@ TEST(IrcProtocolWithServer, 433_not_connected) TEST(IrcProtocolWithServer, 433_connected) { - SRV_INIT; + SRV_INIT_JOIN; /* not enough parameters */ RECV(":server 433"); @@ -3916,12 +3923,20 @@ TEST(IrcProtocolWithServer, 433_connected) RECV(":server 433 alice"); CHECK_ERROR_PARAMS("433", 1, 2); - RECV(":server 433 * alice"); - CHECK_SRV("-- * alice"); - RECV(":server 433 * alice error"); - CHECK_SRV("-- * alice error"); - RECV(":server 433 * alice :Nickname is already in use."); - CHECK_SRV("-- * alice Nickname is already in use."); + RECV(":server 433 alice test"); + CHECK_SRV("-- test"); + RECV(":server 433 alice test error"); + CHECK_SRV("-- test: error"); + RECV(":server 433 alice test :Nickname is already in use."); + CHECK_SRV("-- test: Nickname is already in use."); + + /* + * special case: nickname already used looks like a channel (it should + * never happen in practice): check that the message is still displayed + * on the server buffer + */ + RECV(":server 433 alice #test :Nickname is already in use."); + CHECK_SRV("-- #test: Nickname is already in use."); } /* -- cgit v1.2.3