diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-08-29 22:45:28 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-08-29 22:45:28 +0200 |
commit | 68ecfb16a121fb20098a21f5ca89d7027a49e636 (patch) | |
tree | 4c782842aaaaa753ebcd61939d3b420e5b356fca /tests/unit/plugins/irc/test-irc-protocol.cpp | |
parent | f5604510cd1a1660fa7f11a70a54361830c495bd (diff) | |
download | weechat-68ecfb16a121fb20098a21f5ca89d7027a49e636.zip |
irc: fix target buffer of generic errors when they contain a target nick (closes #1814)
Diffstat (limited to 'tests/unit/plugins/irc/test-irc-protocol.cpp')
-rw-r--r-- | tests/unit/plugins/irc/test-irc-protocol.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 8bb918c6c..d61e5168d 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -3717,6 +3717,71 @@ TEST(IrcProtocolWithServer, 368) /* * Tests functions: + * irc_protocol_cb_401 (no such nick/channel) + */ + +TEST(IrcProtocolWithServer, 401) +{ + SRV_INIT_JOIN; + + /* not enough parameters */ + RECV(":server 401"); + CHECK_ERROR_PARAMS("401", 0, 2); + RECV(":server 401 alice"); + CHECK_ERROR_PARAMS("401", 1, 2); + + RECV(":server 401 alice bob"); + CHECK_SRV("-- bob"); + RECV(":server 401 alice bob :No such nick/channel"); + CHECK_SRV("-- bob: No such nick/channel"); +} + +/* + * Tests functions: + * irc_protocol_cb_402 (no such server) + */ + +TEST(IrcProtocolWithServer, 402) +{ + SRV_INIT_JOIN; + + /* not enough parameters */ + RECV(":server 402"); + CHECK_ERROR_PARAMS("402", 0, 2); + RECV(":server 402 alice"); + CHECK_ERROR_PARAMS("402", 1, 2); + + RECV(":server 402 alice server"); + CHECK_SRV("-- server"); + RECV(":server 402 alice server :No such server"); + CHECK_SRV("-- server: No such server"); +} + +/* + * Tests functions: + * irc_protocol_cb_404 (cannot send to channel) + */ + +TEST(IrcProtocolWithServer, 404) +{ + SRV_INIT_JOIN; + + /* not enough parameters */ + RECV(":server 404"); + CHECK_ERROR_PARAMS("404", 0, 2); + RECV(":server 404 alice"); + CHECK_ERROR_PARAMS("404", 1, 2); + + RECV(":server 404 alice #test"); + CHECK_SRV("-- #test"); + RECV(":server 404 alice #test :Cannot send to channel"); + CHECK_CHAN("-- #test: Cannot send to channel"); + RECV(":server 404 alice #test2 :Cannot send to channel"); + CHECK_SRV("-- #test2: Cannot send to channel"); +} + +/* + * Tests functions: * irc_protocol_cb_432 (erroneous nickname, not connected) */ |