From 74ba21a8c4b49c03f1b023886bd33d0e8c8b55e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 6 Mar 2022 21:34:43 +0100 Subject: tests: add tests on verbose argument of irc join functions --- tests/unit/plugins/irc/test-irc-join.cpp | 39 +++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'tests/unit/plugins/irc/test-irc-join.cpp') 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); } -- cgit v1.2.3