diff tests/src/libirccd/command-plugin-load/main.cpp @ 757:97b356010785

Irccd: create (command|jsapi)::registry Make two list of constructor functions to initialize all command and all Javascript modules to avoid duplicating efforts in case of change. While here, update test fixtures to load all of them for simplicity.
author David Demelier <markand@malikania.fr>
date Mon, 06 Aug 2018 21:27:00 +0200
parents c216d148558d
children 35c1517d705d
line wrap: on
line diff
--- a/tests/src/libirccd/command-plugin-load/main.cpp	Mon Aug 06 12:40:00 2018 +0200
+++ b/tests/src/libirccd/command-plugin-load/main.cpp	Mon Aug 06 21:27:00 2018 +0200
@@ -19,12 +19,9 @@
 #define BOOST_TEST_MODULE "plugin-load"
 #include <boost/test/unit_test.hpp>
 
-#include <irccd/daemon/plugin_service.hpp>
+#include <irccd/test/command_fixture.hpp>
 
-#include <irccd/test/command_test.hpp>
-#include <irccd/test/mock_plugin.hpp>
-
-namespace irccd {
+namespace irccd::test {
 
 namespace {
 
@@ -88,19 +85,20 @@
     }
 };
 
-class plugin_load_test : public command_test<plugin_load_command> {
+class plugin_load_fixture : public command_fixture {
 public:
-    plugin_load_test()
+    plugin_load_fixture()
     {
-        daemon_->plugins().add_loader(std::make_unique<sample_loader>());
-        daemon_->plugins().add_loader(std::make_unique<broken_loader>());
-        daemon_->plugins().add(std::make_unique<mock_plugin>("already"));
+        irccd_.plugins().add_loader(std::make_unique<sample_loader>());
+        irccd_.plugins().add_loader(std::make_unique<broken_loader>());
+        irccd_.plugins().clear();
+        irccd_.plugins().add(std::make_unique<mock_plugin>("already"));
     }
 };
 
 } // !namespace
 
-BOOST_FIXTURE_TEST_SUITE(plugin_load_test_suite, plugin_load_test)
+BOOST_FIXTURE_TEST_SUITE(plugin_load_fixture_suite, plugin_load_fixture)
 
 BOOST_AUTO_TEST_CASE(basic)
 {
@@ -110,7 +108,7 @@
     });
 
     BOOST_TEST(!code);
-    BOOST_TEST(daemon_->plugins().has("test"));
+    BOOST_TEST(irccd_.plugins().has("test"));
 }
 
 BOOST_AUTO_TEST_SUITE(errors)
@@ -166,4 +164,4 @@
 
 BOOST_AUTO_TEST_SUITE_END()
 
-} // !irccd
+} // !irccd::test