From ba7ff87d19217b92dda4eee6a5020aa29441bae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 10 Feb 2022 20:50:16 +0100 Subject: irc: fix parsing of message 223 (m_filter) sent by InspIRCd server (closes #1751) --- tests/unit/plugins/irc/test-irc-protocol.cpp | 130 ++++++++++++++------------- 1 file changed, 66 insertions(+), 64 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 a7ee6eb0b..436ad2e54 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2239,128 +2239,130 @@ TEST(IrcProtocolWithServer, whois_nick_msg) /* not enough parameters */ RECV(":server 223"); - CHECK_ERROR_PARAMS("223", 0, 3); + CHECK_ERROR_PARAMS("223", 0, 2); RECV(":server 223 alice"); - CHECK_ERROR_PARAMS("223", 1, 3); - RECV(":server 223 alice bob"); - CHECK_ERROR_PARAMS("223", 2, 3); + CHECK_ERROR_PARAMS("223", 1, 2); RECV(":server 264"); - CHECK_ERROR_PARAMS("264", 0, 3); + CHECK_ERROR_PARAMS("264", 0, 2); RECV(":server 264 alice"); - CHECK_ERROR_PARAMS("264", 1, 3); - RECV(":server 264 alice bob"); - CHECK_ERROR_PARAMS("264", 2, 3); + CHECK_ERROR_PARAMS("264", 1, 2); RECV(":server 275"); - CHECK_ERROR_PARAMS("275", 0, 3); + CHECK_ERROR_PARAMS("275", 0, 2); RECV(":server 275 alice"); - CHECK_ERROR_PARAMS("275", 1, 3); - RECV(":server 275 alice bob"); - CHECK_ERROR_PARAMS("275", 2, 3); + CHECK_ERROR_PARAMS("275", 1, 2); RECV(":server 276"); - CHECK_ERROR_PARAMS("276", 0, 3); + CHECK_ERROR_PARAMS("276", 0, 2); RECV(":server 276 alice"); - CHECK_ERROR_PARAMS("276", 1, 3); - RECV(":server 276 alice bob"); - CHECK_ERROR_PARAMS("276", 2, 3); + CHECK_ERROR_PARAMS("276", 1, 2); RECV(":server 307"); - CHECK_ERROR_PARAMS("307", 0, 3); + CHECK_ERROR_PARAMS("307", 0, 2); RECV(":server 307 alice"); - CHECK_ERROR_PARAMS("307", 1, 3); - RECV(":server 307 alice bob"); - CHECK_ERROR_PARAMS("307", 2, 3); + CHECK_ERROR_PARAMS("307", 1, 2); RECV(":server 310"); - CHECK_ERROR_PARAMS("310", 0, 3); + CHECK_ERROR_PARAMS("310", 0, 2); RECV(":server 310 alice"); - CHECK_ERROR_PARAMS("310", 1, 3); - RECV(":server 310 alice bob"); - CHECK_ERROR_PARAMS("310", 2, 3); + CHECK_ERROR_PARAMS("310", 1, 2); RECV(":server 313"); - CHECK_ERROR_PARAMS("313", 0, 3); + CHECK_ERROR_PARAMS("313", 0, 2); RECV(":server 313 alice"); - CHECK_ERROR_PARAMS("313", 1, 3); - RECV(":server 313 alice bob"); - CHECK_ERROR_PARAMS("313", 2, 3); + CHECK_ERROR_PARAMS("313", 1, 2); RECV(":server 318"); - CHECK_ERROR_PARAMS("318", 0, 3); + CHECK_ERROR_PARAMS("318", 0, 2); RECV(":server 318 alice"); - CHECK_ERROR_PARAMS("318", 1, 3); - RECV(":server 318 alice bob"); - CHECK_ERROR_PARAMS("318", 2, 3); + CHECK_ERROR_PARAMS("318", 1, 2); RECV(":server 319"); - CHECK_ERROR_PARAMS("319", 0, 3); + CHECK_ERROR_PARAMS("319", 0, 2); RECV(":server 319 alice"); - CHECK_ERROR_PARAMS("319", 1, 3); - RECV(":server 319 alice bob"); - CHECK_ERROR_PARAMS("319", 2, 3); + CHECK_ERROR_PARAMS("319", 1, 2); RECV(":server 320"); - CHECK_ERROR_PARAMS("320", 0, 3); + CHECK_ERROR_PARAMS("320", 0, 2); RECV(":server 320 alice"); - CHECK_ERROR_PARAMS("320", 1, 3); - RECV(":server 320 alice bob"); - CHECK_ERROR_PARAMS("320", 2, 3); + CHECK_ERROR_PARAMS("320", 1, 2); RECV(":server 326"); - CHECK_ERROR_PARAMS("326", 0, 3); + CHECK_ERROR_PARAMS("326", 0, 2); RECV(":server 326 alice"); - CHECK_ERROR_PARAMS("326", 1, 3); - RECV(":server 326 alice bob"); - CHECK_ERROR_PARAMS("326", 2, 3); + CHECK_ERROR_PARAMS("326", 1, 2); RECV(":server 335"); - CHECK_ERROR_PARAMS("335", 0, 3); + CHECK_ERROR_PARAMS("335", 0, 2); RECV(":server 335 alice"); - CHECK_ERROR_PARAMS("335", 1, 3); - RECV(":server 335 alice bob"); - CHECK_ERROR_PARAMS("335", 2, 3); + CHECK_ERROR_PARAMS("335", 1, 2); RECV(":server 378"); - CHECK_ERROR_PARAMS("378", 0, 3); + CHECK_ERROR_PARAMS("378", 0, 2); RECV(":server 378 alice"); - CHECK_ERROR_PARAMS("378", 1, 3); - RECV(":server 378 alice bob"); - CHECK_ERROR_PARAMS("378", 2, 3); + CHECK_ERROR_PARAMS("378", 1, 2); RECV(":server 379"); - CHECK_ERROR_PARAMS("379", 0, 3); + CHECK_ERROR_PARAMS("379", 0, 2); RECV(":server 379 alice"); - CHECK_ERROR_PARAMS("379", 1, 3); - RECV(":server 379 alice bob"); - CHECK_ERROR_PARAMS("379", 2, 3); + CHECK_ERROR_PARAMS("379", 1, 2); RECV(":server 671"); - CHECK_ERROR_PARAMS("671", 0, 3); + CHECK_ERROR_PARAMS("671", 0, 2); RECV(":server 671 alice"); - CHECK_ERROR_PARAMS("671", 1, 3); - RECV(":server 671 alice bob"); - CHECK_ERROR_PARAMS("671", 2, 3); + CHECK_ERROR_PARAMS("671", 1, 2); RECV(":server 223 alice bob UTF-8"); CHECK_SRV("-- [bob] UTF-8"); RECV(":server 223 alice bob :UTF-8"); CHECK_SRV("-- [bob] UTF-8"); + RECV(":server 223 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 264 alice bob :is using encrypted connection"); CHECK_SRV("-- [bob] is using encrypted connection"); + RECV(":server 264 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 275 alice bob :is using secure connection"); CHECK_SRV("-- [bob] is using secure connection"); + RECV(":server 275 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 276 alice bob :has client certificate fingerprint"); CHECK_SRV("-- [bob] has client certificate fingerprint"); + RECV(":server 276 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 307 alice bob :registered nick"); CHECK_SRV("-- [bob] registered nick"); + RECV(":server 307 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 310 alice bob :help mode"); CHECK_SRV("-- [bob] help mode"); + RECV(":server 310 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 313 alice bob :operator"); CHECK_SRV("-- [bob] operator"); + RECV(":server 313 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 318 alice bob :end"); CHECK_SRV("-- [bob] end"); + RECV(":server 318 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 319 alice bob :channels"); CHECK_SRV("-- [bob] channels"); + RECV(":server 319 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 320 alice bob :identified user"); CHECK_SRV("-- [bob] identified user"); + RECV(":server 320 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 326 alice bob :has oper privs"); CHECK_SRV("-- [bob] has oper privs"); + RECV(":server 326 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 335 alice bob :is a bot"); CHECK_SRV("-- [bob] is a bot"); + RECV(":server 335 alice bob"); + CHECK_SRV("-- bob"); + RECV(":server 378 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 378 alice bob :connecting from"); CHECK_SRV("-- [bob] connecting from"); + RECV(":server 378 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 379 alice bob :using modes"); CHECK_SRV("-- [bob] using modes"); + RECV(":server 379 alice bob"); + CHECK_SRV("-- bob"); RECV(":server 671 alice bob :secure connection"); CHECK_SRV("-- [bob] secure connection"); + RECV(":server 671 alice bob"); + CHECK_SRV("-- bob"); } /* @@ -2377,16 +2379,16 @@ TEST(IrcProtocolWithServer, whowas_nick_msg) /* not enough parameters */ RECV(":server 369"); - CHECK_ERROR_PARAMS("369", 0, 3); + CHECK_ERROR_PARAMS("369", 0, 2); RECV(":server 369 alice"); - CHECK_ERROR_PARAMS("369", 1, 3); - RECV(":server 369 alice bob"); - CHECK_ERROR_PARAMS("369", 2, 3); + CHECK_ERROR_PARAMS("369", 1, 2); RECV(":server 369 alice bob end"); CHECK_SRV("-- [bob] end"); RECV(":server 369 alice bob :end"); CHECK_SRV("-- [bob] end"); + RECV(":server 369 alice bob"); + CHECK_SRV("-- bob"); } /* -- cgit v1.2.3