comparison 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
comparison
equal deleted inserted replaced
664:ce2748ffcf36 665:7ed23c858694
1 /*
2 * main.cpp -- test irccdctl rule-info
3 *
4 * Copyright (c) 2013-2018 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #define BOOST_TEST_MODULE "irccdctl rule-info"
20 #include <boost/test/unit_test.hpp>
21
22 #include <irccd/test/cli_test.hpp>
23
24 namespace irccd {
25
26 BOOST_FIXTURE_TEST_SUITE(rule_info_suite, cli_test)
27
28 BOOST_AUTO_TEST_CASE(info)
29 {
30 const auto result = run("irccd-rules.conf", { "rule-info", "0" });
31
32 BOOST_TEST(result.first.size() == 8U);
33 BOOST_TEST(result.second.size() == 0U);
34 BOOST_TEST(result.first[0] == "rule: 0");
35 BOOST_TEST(result.first[1] == "servers: s1 s2 ");
36 BOOST_TEST(result.first[2] == "channels: c1 c2 ");
37 BOOST_TEST(result.first[3] == "plugins: p1 p2 ");
38 BOOST_TEST(result.first[4] == "events: onCommand onMessage ");
39 BOOST_TEST(result.first[5] == "action: drop");
40 }
41
42 BOOST_AUTO_TEST_SUITE_END()
43
44 } // !irccd