summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-03-31 19:52:34 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-03-31 19:54:26 +0200
commit10b2fa3a6180dec90ccd4dab58fd750dcdf80f82 (patch)
tree60ecfe36dd9c3035bab71a7120d403cad7ecff97 /tests/unit
parent7558fe7c1b28bdadf7e3bdd47938b1d1a6feb212 (diff)
downloadweechat-10b2fa3a6180dec90ccd4dab58fd750dcdf80f82.zip
irc: fix target buffer for commands 432/433 when the nickname looks like a channel
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp43
1 files changed, 29 insertions, 14 deletions
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.");
}
/*