summaryrefslogtreecommitdiff
path: root/tests/unit/plugins/irc/test-irc-join.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-03-06 21:34:43 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-03-10 21:12:46 +0100
commit74ba21a8c4b49c03f1b023886bd33d0e8c8b55e5 (patch)
tree950d004e5fcbfac6a382b206d77dec2a14f6ea52 /tests/unit/plugins/irc/test-irc-join.cpp
parent02bdf854bc6730794bd7b64777f9a74cdaf3fc10 (diff)
downloadweechat-74ba21a8c4b49c03f1b023886bd33d0e8c8b55e5.zip
tests: add tests on verbose argument of irc join functions
Diffstat (limited to 'tests/unit/plugins/irc/test-irc-join.cpp')
-rw-r--r--tests/unit/plugins/irc/test-irc-join.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/unit/plugins/irc/test-irc-join.cpp b/tests/unit/plugins/irc/test-irc-join.cpp
index dee3aab23..7d59894c2 100644
--- a/tests/unit/plugins/irc/test-irc-join.cpp
+++ b/tests/unit/plugins/irc/test-irc-join.cpp
@@ -21,9 +21,10 @@
#include "CppUTest/TestHarness.h"
+#include "tests/tests.h"
+
extern "C"
{
-#include "tests/tests.h"
#include "src/core/wee-arraylist.h"
#include "src/core/wee-config-file.h"
#include "src/plugins/irc/irc-channel.h"
@@ -410,6 +411,42 @@ TEST(IrcJoin, AddRemoveChannelsAutojoin)
"#abc,#xyz,#def,#ghi key_abc,key_xyz",
CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN]));
+ record_start ();
+ irc_join_remove_channel_from_autojoin (server, "#xyz", 1);
+ STRCMP_EQUAL(
+ "#abc,#def,#ghi key_abc",
+ CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN]));
+ CHECK(record_search ("core.weechat",
+ "Autojoin changed from "
+ "\"#abc,#xyz,#def,#ghi key_abc,key_xyz\" to "
+ "\"#abc,#def,#ghi key_abc\""));
+ record_stop ();
+
+ record_start ();
+ irc_join_add_channel_to_autojoin (server, "#xyz", NULL, 1);
+ STRCMP_EQUAL(
+ "#abc,#def,#ghi,#xyz key_abc",
+ CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN]));
+ CHECK(record_search ("core.weechat",
+ "Autojoin changed from "
+ "\"#abc,#def,#ghi key_abc\" to "
+ "\"#abc,#def,#ghi,#xyz key_abc\""));
+ record_stop ();
+
+ irc_join_remove_channel_from_autojoin (server, "#abc", 0);
+ irc_join_remove_channel_from_autojoin (server, "#def", 0);
+ irc_join_remove_channel_from_autojoin (server, "#ghi", 0);
+ irc_join_remove_channel_from_autojoin (server, "#xyz", 0);
+
+ record_start ();
+ irc_join_add_channel_to_autojoin (server, "#abc", NULL, 1);
+ STRCMP_EQUAL(
+ "#abc",
+ CONFIG_STRING(server->options[IRC_SERVER_OPTION_AUTOJOIN]));
+ CHECK(record_search ("core.weechat",
+ "Autojoin changed from empty value to \"#abc\""));
+ record_stop ();
+
irc_server_free (server);
}