Mercurial > irccd
diff tests/src/irccdctl/cli-rule-info/main.cpp @ 665:7ed23c858694
Tests: test irccdctl (rule-* commands) #785
While here, fix rule-edit which were triggering invalid_index because it was not
added to the request.
Also fix missing events from configuration file because they were forgotten.
Finally, use std::set instead of std::unordered_set for a sorted output in
rule-list and rule-info to ensure long-term compatibility in output.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 29 Mar 2018 20:01:02 +0200 |
parents | |
children | a4082de4e94e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/src/irccdctl/cli-rule-info/main.cpp Thu Mar 29 20:01:02 2018 +0200 @@ -0,0 +1,44 @@ +/* + * main.cpp -- test irccdctl rule-info + * + * Copyright (c) 2013-2018 David Demelier <markand@malikania.fr> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#define BOOST_TEST_MODULE "irccdctl rule-info" +#include <boost/test/unit_test.hpp> + +#include <irccd/test/cli_test.hpp> + +namespace irccd { + +BOOST_FIXTURE_TEST_SUITE(rule_info_suite, cli_test) + +BOOST_AUTO_TEST_CASE(info) +{ + const auto result = run("irccd-rules.conf", { "rule-info", "0" }); + + BOOST_TEST(result.first.size() == 8U); + BOOST_TEST(result.second.size() == 0U); + BOOST_TEST(result.first[0] == "rule: 0"); + BOOST_TEST(result.first[1] == "servers: s1 s2 "); + BOOST_TEST(result.first[2] == "channels: c1 c2 "); + BOOST_TEST(result.first[3] == "plugins: p1 p2 "); + BOOST_TEST(result.first[4] == "events: onCommand onMessage "); + BOOST_TEST(result.first[5] == "action: drop"); +} + +BOOST_AUTO_TEST_SUITE_END() + +} // !irccd