summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-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);
}