Mercurial > irccd
changeset 250:79d9840811a1
Irccd: fix tests
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 18 Aug 2016 16:42:10 +0200 |
parents | c2c40fc0beb1 |
children | 7b54db12be51 |
files | tests/command/main.cpp tests/js-elapsedtimer/main.cpp tests/js-file/main.cpp tests/js-irccd/main.cpp tests/js-logger/main.cpp tests/js-system/main.cpp tests/js-timer/main.cpp tests/js-unicode/main.cpp tests/js-util/main.cpp tests/plugin-ask/main.cpp tests/plugin-auth/main.cpp tests/plugin-hangman/main.cpp tests/plugin-history/main.cpp tests/plugin-logger/main.cpp tests/plugin-plugin/main.cpp |
diffstat | 15 files changed, 42 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/command/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/command/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -25,21 +25,21 @@ class MyCommand : public Command { public: MyCommand() - : Command("test", "Test") + : Command("test", "Test", "This is a super command") { } - std::string help() const override - { - return "This is a super command"; - } - std::vector<Property> properties() const { return { - { "b", { json::Type::Boolean }}, - { "i", { json::Type::Int }}, - { "m", { json::Type::Boolean, json::Type::Int, nlohmann::json::value_t::string }} + { "b", { nlohmann::json::value_t::boolean }}, + { "i", { nlohmann::json::value_t::number_integer }}, + { "m", { + nlohmann::json::value_t::boolean, + nlohmann::json::value_t::number_integer, + nlohmann::json::value_t::string + } + } }; } };
--- a/tests/js-elapsedtimer/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-elapsedtimer/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -37,8 +37,8 @@ TestElapsedTimer() : m_plugin(std::make_shared<JsPlugin>("empty", SOURCEDIR "/empty.js")) { - m_irccd.moduleService().get("Irccd")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.ElapsedTimer")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.ElapsedTimer")->load(m_irccd, m_plugin); } };
--- a/tests/js-file/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-file/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -36,8 +36,8 @@ TestJsFile() : m_plugin(std::make_shared<JsPlugin>("empty", SOURCEDIR "/empty.js")) { - m_irccd.moduleService().get("Irccd")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.File")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.File")->load(m_irccd, m_plugin); } };
--- a/tests/js-irccd/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-irccd/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -34,7 +34,7 @@ TestJsIrccd() : m_plugin(std::make_shared<JsPlugin>("empty", SOURCEDIR "/empty.js")) { - m_irccd.moduleService().get("Irccd")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd")->load(m_irccd, m_plugin); } };
--- a/tests/js-logger/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-logger/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -62,9 +62,9 @@ TestJsLogger() : m_plugin(std::make_shared<JsPlugin>("test", SOURCEDIR "/empty.js")) { - m_irccd.moduleService().get("Irccd")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.Plugin")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.Logger")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.Plugin")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.Logger")->load(m_irccd, m_plugin); } };
--- a/tests/js-system/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-system/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -36,9 +36,9 @@ TestJsSystem() : m_plugin(std::make_shared<JsPlugin>("empty", SOURCEDIR "/empty.js")) { - m_irccd.moduleService().get("Irccd")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.File")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.System")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.File")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.System")->load(m_irccd, m_plugin); } };
--- a/tests/js-timer/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-timer/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -35,7 +35,7 @@ auto plugin = std::make_shared<JsPlugin>("timer", IRCCD_TESTS_DIRECTORY "/timer-single.js"); plugin->onLoad(irccd); - irccd.pluginService().add(plugin); + irccd.plugins().add(plugin); while (timer.elapsed() < 3000) { irccd.poll(); @@ -54,7 +54,7 @@ auto plugin = std::make_shared<JsPlugin>("timer", IRCCD_TESTS_DIRECTORY "/timer-repeat.js"); plugin->onLoad(irccd); - irccd.pluginService().add(plugin); + irccd.plugins().add(plugin); while (timer.elapsed() < 3000) { irccd.poll();
--- a/tests/js-unicode/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-unicode/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -39,8 +39,8 @@ TestJsUnicode() : m_plugin(std::make_shared<JsPlugin>("empty", SOURCEDIR "/empty.js")) { - m_irccd.moduleService().get("Irccd")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.Unicode")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.Unicode")->load(m_irccd, m_plugin); } };
--- a/tests/js-util/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/js-util/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -35,8 +35,8 @@ TestJsUtil() : m_plugin(std::make_shared<JsPlugin>("empty", SOURCEDIR "/empty.js")) { - m_irccd.moduleService().get("Irccd")->load(m_irccd, m_plugin); - m_irccd.moduleService().get("Irccd.Util")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd")->load(m_irccd, m_plugin); + m_irccd.modules().get("Irccd.Util")->load(m_irccd, m_plugin); } };
--- a/tests/plugin-ask/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/plugin-ask/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -30,7 +30,7 @@ public: inline ServerTest() - : Server("test", ServerInfo()) + : Server("test") { } @@ -55,7 +55,7 @@ public: AskTest() - : m_ps(m_irccd.pluginService()) + : m_ps(m_irccd.plugins()) , m_server(std::make_shared<ServerTest>()) { m_ps.setConfig("ask", {{"file", SOURCEDIR "/answers.conf"}}); @@ -69,7 +69,10 @@ bool no = false; bool yes = false; - // Invoke the plugin 1000 times, it will be very unlucky to not have both answers in that amount of tries. + /* + * Invoke the plugin 1000 times, it will be very unlucky to not have both + * answers in that amount of tries. + */ for (int i = 0; i < 1000; ++i) { m_plugin->onCommand(m_irccd, MessageEvent{m_server, "tester", "#dummy", ""});
--- a/tests/plugin-auth/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/plugin-auth/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -30,7 +30,7 @@ public: inline ServerTest(std::string name) - : Server(std::move(name), ServerInfo()) + : Server(std::move(name)) { } @@ -57,7 +57,7 @@ public: AuthTest() - : m_ps(m_irccd.pluginService()) + : m_ps(m_irccd.plugins()) , m_nickserv1(std::make_shared<ServerTest>("nickserv1")) , m_nickserv2(std::make_shared<ServerTest>("nickserv2")) , m_quakenet(std::make_shared<ServerTest>("quakenet"))
--- a/tests/plugin-hangman/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/plugin-hangman/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -30,7 +30,7 @@ public: inline ServerTest() - : Server("test", ServerInfo()) + : Server("test") { } @@ -55,7 +55,7 @@ public: HangmanTest() - : m_ps(m_irccd.pluginService()) + : m_ps(m_irccd.plugins()) , m_server(std::make_shared<ServerTest>()) { m_ps.setFormats("hangman", {
--- a/tests/plugin-history/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/plugin-history/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -32,7 +32,7 @@ public: inline ServerTest() - : Server("test", ServerInfo()) + : Server("test") { } @@ -57,7 +57,7 @@ public: HistoryTest() - : m_ps(m_irccd.pluginService()) + : m_ps(m_irccd.plugins()) , m_server(std::make_shared<ServerTest>()) { m_ps.setFormats("history", {
--- a/tests/plugin-logger/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/plugin-logger/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -31,7 +31,7 @@ class ServerTest : public Server { public: inline ServerTest() - : Server("test", ServerInfo()) + : Server("test") { } }; @@ -53,7 +53,7 @@ public: LoggerTest() - : m_ps(m_irccd.pluginService()) + : m_ps(m_irccd.plugins()) , m_server(std::make_shared<ServerTest>()) { remove(BINARYDIR "/log.txt");
--- a/tests/plugin-plugin/main.cpp Wed Aug 17 23:00:59 2016 +0200 +++ b/tests/plugin-plugin/main.cpp Thu Aug 18 16:42:10 2016 +0200 @@ -35,7 +35,7 @@ public: inline ServerTest() - : Server("test", ServerInfo()) + : Server("test") { } @@ -72,7 +72,7 @@ public: PluginTest() - : m_ps(m_irccd.pluginService()) + : m_ps(m_irccd.plugins()) , m_server(std::make_shared<ServerTest>()) { m_ps.add(std::make_shared<FakePlugin>());