summaryrefslogtreecommitdiff
path: root/tests/unit/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-06-19 17:50:07 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-06-19 18:22:49 +0200
commitef318cb70c3db60d7647fce3c498813a87c43b46 (patch)
tree2fcbbb16556755e9189db106de91cc224fc8ff6a /tests/unit/plugins
parent947f73bd506deec427e7393c6e2c696424415780 (diff)
downloadweechat-ef318cb70c3db60d7647fce3c498813a87c43b46.zip
irc: enable all capabilities by default (supported by both server and WeeChat) (closes #320)
Capabilities can be excluded with the format: "*,!account-*,!extended-join".
Diffstat (limited to 'tests/unit/plugins')
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index 6b9f2a7e2..eff9e3346 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -43,6 +43,8 @@ extern const char *irc_protocol_nick_address (struct t_irc_server *server,
const char *nickname,
const char *address);
extern struct t_hashtable *irc_protocol_get_message_tags (const char *tags);
+extern char *irc_protocol_cap_to_enable (const char *capabilities,
+ int sasl_requested);
}
#include "tests/tests.h"
@@ -54,6 +56,15 @@ extern struct t_hashtable *irc_protocol_get_message_tags (const char *tags);
"USERLEN=16 HOSTLEN=32 CHANNELLEN=50 TOPICLEN=390 DEAF=D " \
"CHANTYPES=# CHANMODES=eIbq,k,flj,CFLMPQScgimnprstuz " \
"MONITOR=100"
+#define IRC_ALL_CAPS "account-notify,away-notify,cap-notify,chghost," \
+ "extended-join,invite-notify,multi-prefix,server-time,setname," \
+ "userhost-in-names"
+
+#define WEE_CHECK_CAP_TO_ENABLE(__result, __string, __sasl_requested) \
+ str = irc_protocol_cap_to_enable (__string, __sasl_requested); \
+ STRCMP_EQUAL(__result, str); \
+ free (str);
+
struct t_irc_server *ptr_server;
@@ -532,6 +543,25 @@ TEST(IrcProtocolWithServer, away)
/*
* Tests functions:
+ * irc_protocol_cap_to_enable
+ */
+
+TEST(IrcProtocol, cap_to_enable)
+{
+ char *str;
+
+ WEE_CHECK_CAP_TO_ENABLE("", NULL, 0);
+ WEE_CHECK_CAP_TO_ENABLE("", "", 0);
+ WEE_CHECK_CAP_TO_ENABLE("extended-join", "extended-join", 0);
+ WEE_CHECK_CAP_TO_ENABLE("extended-join,sasl", "extended-join", 1);
+ WEE_CHECK_CAP_TO_ENABLE(IRC_ALL_CAPS, "*", 0);
+ WEE_CHECK_CAP_TO_ENABLE(IRC_ALL_CAPS ",sasl", "*", 1);
+ WEE_CHECK_CAP_TO_ENABLE(IRC_ALL_CAPS ",!away-notify,!extended-join,sasl",
+ "*,!away-notify,!extended-join", 1);
+}
+
+/*
+ * Tests functions:
* irc_protocol_cb_cap
*/