summaryrefslogtreecommitdiff
path: root/tests/unit/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-04-03 20:00:32 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-03 20:00:32 +0200
commit1c3b871204072b612ea3793708b508fc4de923be (patch)
tree9b488b9abc01c09988f4115ebf05cf1a4b07363a /tests/unit/plugins/irc
parentb8f40cfa99826d2102f1ffe0193137f5f7e45cfe (diff)
downloadweechat-1c3b871204072b612ea3793708b508fc4de923be.zip
irc: don't switch to buffer of joined channel if it was not manually joined nor present in server autojoin option
Diffstat (limited to 'tests/unit/plugins/irc')
-rw-r--r--tests/unit/plugins/irc/test-irc-join.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-join.cpp b/tests/unit/plugins/irc/test-irc-join.cpp
index b9a320964..ee1b17ebc 100644
--- a/tests/unit/plugins/irc/test-irc-join.cpp
+++ b/tests/unit/plugins/irc/test-irc-join.cpp
@@ -353,6 +353,38 @@ TEST(IrcJoin, SplitBuildString)
/*
* Tests functions:
+ * irc_join_has_channel
+ */
+
+TEST(IrcJoin, HasChannel)
+{
+ struct t_irc_server *server;
+
+ server = irc_server_alloc ("my_ircd");
+ CHECK(server);
+
+ LONGS_EQUAL(0, irc_join_has_channel (NULL, NULL, NULL));
+ LONGS_EQUAL(0, irc_join_has_channel (server, NULL, NULL));
+ LONGS_EQUAL(0, irc_join_has_channel (server, NULL, ""));
+ LONGS_EQUAL(0, irc_join_has_channel (server, "#abc,#def key_abc", NULL));
+ LONGS_EQUAL(0, irc_join_has_channel (server, "#abc,#def key_abc", ""));
+ LONGS_EQUAL(0, irc_join_has_channel (server, "#abc,#def key_abc", "#zzz"));
+
+ LONGS_EQUAL(1, irc_join_has_channel (NULL, "#abc,#def key_abc", "#abc"));
+ LONGS_EQUAL(1, irc_join_has_channel (NULL, "#abc,#def key_abc", "#ABC"));
+ LONGS_EQUAL(1, irc_join_has_channel (NULL, "#abc,#def key_abc", "#def"));
+ LONGS_EQUAL(1, irc_join_has_channel (NULL, "#abc,#def key_abc", "#DEF"));
+
+ LONGS_EQUAL(1, irc_join_has_channel (server, "#abc,#def key_abc", "#abc"));
+ LONGS_EQUAL(1, irc_join_has_channel (server, "#abc,#def key_abc", "#ABC"));
+ LONGS_EQUAL(1, irc_join_has_channel (server, "#abc,#def key_abc", "#def"));
+ LONGS_EQUAL(1, irc_join_has_channel (server, "#abc,#def key_abc", "#DEF"));
+
+ irc_server_free (server);
+}
+
+/*
+ * Tests functions:
* irc_join_add_channel
*/