summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-03-17 20:54:07 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-03-17 20:54:07 +0100
commita709dd05a67c25275517fb4b63e17ac8c5e07c17 (patch)
treed29e1c0722add92e3fd2010e24cab1afc8efb9f9 /tests
parent332a4adc260b94060ca20240641f3c1e02001ae5 (diff)
downloadweechat-a709dd05a67c25275517fb4b63e17ac8c5e07c17.zip
tests: add tests on function irc_protocol_cb_join
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index f165423f6..91d36cdea 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -388,6 +388,59 @@ TEST(IrcProtocolWithServer, chghost)
/*
* Tests functions:
+ * irc_protocol_cb_join
+ */
+
+TEST(IrcProtocolWithServer, join)
+{
+ struct t_irc_channel *ptr_channel;
+ struct t_irc_nick *ptr_nick;
+
+ server_recv (":server 001 alice");
+
+ POINTERS_EQUAL(NULL, ptr_server->channels);
+
+ server_recv (":alice!user@host JOIN #test");
+
+ ptr_channel = ptr_server->channels;
+
+ CHECK(ptr_channel);
+ CHECK(ptr_channel == ptr_server->last_channel);
+
+ LONGS_EQUAL(IRC_CHANNEL_TYPE_CHANNEL, ptr_channel->type);
+ STRCMP_EQUAL("#test", ptr_channel->name);
+ POINTERS_EQUAL(NULL, ptr_channel->topic);
+ POINTERS_EQUAL(NULL, ptr_channel->modes);
+ LONGS_EQUAL(0, ptr_channel->limit);
+ POINTERS_EQUAL(NULL, ptr_channel->key);
+ LONGS_EQUAL(0, ptr_channel->checking_whox);
+ POINTERS_EQUAL(NULL, ptr_channel->away_message);
+ LONGS_EQUAL(0, ptr_channel->has_quit_server);
+ LONGS_EQUAL(0, ptr_channel->cycle);
+ LONGS_EQUAL(0, ptr_channel->part);
+ LONGS_EQUAL(0, ptr_channel->part);
+ POINTERS_EQUAL(NULL, ptr_channel->pv_remote_nick_color);
+ POINTERS_EQUAL(NULL, ptr_channel->hook_autorejoin);
+
+ ptr_nick = ptr_channel->nicks;
+
+ LONGS_EQUAL(1, ptr_channel->nicks_count);
+ CHECK(ptr_nick);
+ CHECK(ptr_nick == ptr_channel->last_nick);
+ STRCMP_EQUAL("alice", ptr_nick->name);
+ STRCMP_EQUAL("user@host", ptr_nick->host);
+ STRCMP_EQUAL(" ", ptr_nick->prefixes);
+ STRCMP_EQUAL(" ", ptr_nick->prefix);
+ LONGS_EQUAL(0, ptr_nick->away);
+ POINTERS_EQUAL(NULL, ptr_nick->account);
+ POINTERS_EQUAL(NULL, ptr_nick->realname);
+ CHECK(ptr_nick->color);
+
+ CHECK(ptr_channel->buffer);
+}
+
+/*
+ * Tests functions:
* irc_protocol_cb_001 (empty)
*/