From 6ffebec1a6005c0400b1935e83ac67f333da9b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 2 Jul 2022 21:11:32 +0200 Subject: [PATCH] tests: add tests on IRC messages 524/704/705/706 (issue #1772) --- tests/unit/plugins/irc/test-irc-protocol.cpp | 85 ++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index d6c4ca47e..dc7079c7a 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -3870,6 +3870,91 @@ TEST(IrcProtocolWithServer, 470) CHECK_SRV("-- #test: #test2 Forwarding to another channel"); } +/* + * Tests functions: + * irc_protocol_cb_524 (help not found) + */ + +TEST(IrcProtocolWithServer, 524) +{ + SRV_INIT; + + /* not enough parameters */ + RECV(":server 524"); + CHECK_ERROR_PARAMS("524", 0, 2); + RECV(":server 524 alice"); + CHECK_ERROR_PARAMS("524", 1, 2); + + RECV(":server 524 alice UNKNOWN"); + CHECK_SRV("--"); + RECV(":server 524 alice UNKNOWN :Help not found"); + CHECK_SRV("-- Help not found"); +} + +/* + * Tests functions: + * irc_protocol_cb_704 (start of HELP/HELPOP) + */ + +TEST(IrcProtocolWithServer, 704) +{ + SRV_INIT; + + /* not enough parameters */ + RECV(":server 704"); + CHECK_ERROR_PARAMS("704", 0, 2); + RECV(":server 704 alice"); + CHECK_ERROR_PARAMS("704", 1, 2); + + RECV(":server 704 alice MODE"); + CHECK_SRV("--"); + RECV(":server 704 alice MODE " + ":MODE [ [...]]"); + CHECK_SRV("-- MODE [ [...]]"); +} + +/* + * Tests functions: + * irc_protocol_cb_705 (body of HELP/HELPOP) + */ + +TEST(IrcProtocolWithServer, 705) +{ + SRV_INIT; + + /* not enough parameters */ + RECV(":server 705"); + CHECK_ERROR_PARAMS("705", 0, 2); + RECV(":server 705 alice"); + CHECK_ERROR_PARAMS("705", 1, 2); + + RECV(":server 705 alice MODE"); + CHECK_SRV("--"); + RECV(":server 705 alice MODE :Sets and removes modes from the given target."); + CHECK_SRV("-- Sets and removes modes from the given target."); +} + +/* + * Tests functions: + * irc_protocol_cb_706 (end of HELP/HELPOP) + */ + +TEST(IrcProtocolWithServer, 706) +{ + SRV_INIT; + + /* not enough parameters */ + RECV(":server 706"); + CHECK_ERROR_PARAMS("706", 0, 2); + RECV(":server 706 alice"); + CHECK_ERROR_PARAMS("706", 1, 2); + + RECV(":server 706 alice MODE"); + CHECK_SRV("--"); + RECV(":server 706 alice MODE :End of /HELPOP"); + CHECK_SRV("-- End of /HELPOP"); +} + /* * Tests functions: * irc_protocol_cb_728 (quietlist)