comparison tests/src/libirccd/command-plugin-info/main.cpp @ 722:3e816cebed2c

Irccd: make plugin pure abstract, closes #796 @3h
author David Demelier <markand@malikania.fr>
date Mon, 16 Jul 2018 21:19:47 +0200
parents 1081e45b8628
children ae88795feb99
comparison
equal deleted inserted replaced
721:2fa1f2c898ee 722:3e816cebed2c
24 24
25 #include <irccd/test/command_test.hpp> 25 #include <irccd/test/command_test.hpp>
26 26
27 namespace irccd { 27 namespace irccd {
28 28
29 namespace {
30
31 class sample_plugin : public plugin {
32 public:
33 auto get_name() const noexcept -> std::string_view
34 {
35 return "test";
36 }
37
38 auto get_author() const noexcept -> std::string_view override
39 {
40 return "Francis Beaugrand";
41 }
42
43 auto get_license() const noexcept -> std::string_view override
44 {
45 return "GPL";
46 }
47
48 auto get_summary() const noexcept -> std::string_view override
49 {
50 return "Completely useless plugin";
51 }
52
53 auto get_version() const noexcept -> std::string_view override
54 {
55 return "0.0.0.0.0.0.0.0.1-beta5";
56 }
57 };
58
29 BOOST_FIXTURE_TEST_SUITE(plugin_info_test_suite, command_test<plugin_info_command>) 59 BOOST_FIXTURE_TEST_SUITE(plugin_info_test_suite, command_test<plugin_info_command>)
30 60
31 BOOST_AUTO_TEST_CASE(basic) 61 BOOST_AUTO_TEST_CASE(basic)
32 { 62 {
33 auto plg = std::make_unique<plugin>("test", ""); 63 auto plg = std::make_unique<sample_plugin>();
34 auto response = nlohmann::json(); 64 auto response = nlohmann::json();
35 65
36 plg->set_author("Francis Beaugrand"); 66 daemon_->plugins().add("test", std::move(plg));
37 plg->set_license("GPL");
38 plg->set_summary("Completely useless plugin");
39 plg->set_version("0.0.0.0.0.0.0.0.1-beta5");
40 daemon_->plugins().add(std::move(plg));
41 67
42 const auto result = request({ 68 const auto result = request({
43 { "command", "plugin-info" }, 69 { "command", "plugin-info" },
44 { "plugin", "test" }, 70 { "plugin", "test" },
45 }); 71 });
77 103
78 BOOST_AUTO_TEST_SUITE_END() 104 BOOST_AUTO_TEST_SUITE_END()
79 105
80 BOOST_AUTO_TEST_SUITE_END() 106 BOOST_AUTO_TEST_SUITE_END()
81 107
108 } // !namespace
109
82 } // !irccd 110 } // !irccd