# HG changeset patch # User David Demelier # Date 1512549177 -3600 # Node ID 029667d16d1242b98203722fae40384e22e60c4d # Parent 0a5cb2b65621d0e946434862f003e29c1cf10edf Tests: add multiple commands in command_test diff -r 0a5cb2b65621 -r 029667d16d12 libirccd-test/irccd/command_test.hpp --- a/libirccd-test/irccd/command_test.hpp Tue Dec 05 16:31:35 2017 +0100 +++ b/libirccd-test/irccd/command_test.hpp Wed Dec 06 09:32:57 2017 +0100 @@ -33,8 +33,22 @@ namespace irccd { -template +template class command_test { +private: + template + inline void add() + { + daemon_->commands().add(std::make_unique()); + } + + template + inline void add() + { + add(); + add(); + } + protected: boost::asio::io_service service_; boost::asio::deadline_timer timer_; @@ -58,8 +72,8 @@ } }; -template -command_test::command_test() +template +command_test::command_test() : timer_(service_) , daemon_(std::make_unique(service_)) { @@ -76,7 +90,7 @@ ctl_ = std::make_unique(*conn_); // Add the server and the command. - daemon_->commands().add(std::make_unique()); + add(); daemon_->transports().add(std::make_unique(std::move(acc))); timer_.expires_from_now(boost::posix_time::seconds(10)); diff -r 0a5cb2b65621 -r 029667d16d12 tests/src/rule-add-command/main.cpp --- a/tests/src/rule-add-command/main.cpp Tue Dec 05 16:31:35 2017 +0100 +++ b/tests/src/rule-add-command/main.cpp Wed Dec 06 09:32:57 2017 +0100 @@ -30,13 +30,7 @@ namespace { -class rule_add_test : public command_test { -public: - rule_add_test() - { - daemon_->commands().add(std::make_unique()); - } -}; +using rule_add_test = command_test; } // !namespace diff -r 0a5cb2b65621 -r 029667d16d12 tests/src/rule-edit-command/main.cpp --- a/tests/src/rule-edit-command/main.cpp Tue Dec 05 16:31:35 2017 +0100 +++ b/tests/src/rule-edit-command/main.cpp Wed Dec 06 09:32:57 2017 +0100 @@ -30,11 +30,10 @@ namespace { -class rule_edit_test : public command_test { +class rule_edit_test : public command_test { public: rule_edit_test() { - daemon_->commands().add(std::make_unique()); daemon_->rules().add(rule( { "s1", "s2" }, { "c1", "c2" }, diff -r 0a5cb2b65621 -r 029667d16d12 tests/src/rule-move-command/main.cpp --- a/tests/src/rule-move-command/main.cpp Tue Dec 05 16:31:35 2017 +0100 +++ b/tests/src/rule-move-command/main.cpp Wed Dec 06 09:32:57 2017 +0100 @@ -30,11 +30,10 @@ namespace { -class rule_move_test : public command_test { +class rule_move_test : public command_test { public: rule_move_test() { - daemon_->commands().add(std::make_unique()); daemon_->rules().add(rule( { "s0" }, { "c0" }, diff -r 0a5cb2b65621 -r 029667d16d12 tests/src/rule-remove-command/main.cpp --- a/tests/src/rule-remove-command/main.cpp Tue Dec 05 16:31:35 2017 +0100 +++ b/tests/src/rule-remove-command/main.cpp Wed Dec 06 09:32:57 2017 +0100 @@ -30,11 +30,10 @@ namespace { -class rule_remove_test : public command_test { +class rule_remove_test : public command_test { public: rule_remove_test() { - daemon_->commands().add(std::make_unique()); daemon_->rules().add(rule( { "s1", "s2" }, { "c1", "c2" },