Mercurial > irccd
comparison tests/src/irccdctl/cli-hook-list/main.cpp @ 895:f0d6bc79aa32
irccd: implement hooks, closes #2342 @2h
The hook mechanism is an alternative approach to plugins which allow the user to
write lightweight scripts in any language.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 05 Sep 2019 13:39:32 +0200 |
parents | |
children | 5e25439fe98d |
comparison
equal
deleted
inserted
replaced
891:6704e7ded799 | 895:f0d6bc79aa32 |
---|---|
1 /* | |
2 * main.cpp -- test irccdctl hook-list | |
3 * | |
4 * Copyright (c) 2013-2019 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 hook-list" | |
20 #include <boost/test/unit_test.hpp> | |
21 | |
22 #include <irccd/test/cli_fixture.hpp> | |
23 | |
24 using namespace irccd::test; | |
25 | |
26 using irccd::daemon::hook; | |
27 | |
28 namespace irccd { | |
29 | |
30 namespace { | |
31 | |
32 class hook_list_fixture : public cli_fixture { | |
33 public: | |
34 hook_list_fixture() | |
35 : cli_fixture(IRCCDCTL_EXECUTABLE) | |
36 { | |
37 bot_.get_hooks().add(hook("true", "/bin/true")); | |
38 bot_.get_hooks().add(hook("false", "/bin/false")); | |
39 } | |
40 }; | |
41 | |
42 BOOST_FIXTURE_TEST_SUITE(hook_list_suite, hook_list_fixture) | |
43 | |
44 BOOST_AUTO_TEST_CASE(basic) | |
45 { | |
46 start(); | |
47 | |
48 const auto [code, out, err] = exec({ "hook-list" }); | |
49 | |
50 BOOST_TEST(!code); | |
51 BOOST_TEST(out.size() == 2U); | |
52 BOOST_TEST(err.size() == 0U); | |
53 BOOST_TEST(out[0] == "true /bin/true"); | |
54 BOOST_TEST(out[1] == "false /bin/false"); | |
55 } | |
56 | |
57 BOOST_AUTO_TEST_SUITE_END() | |
58 | |
59 } // !namespace | |
60 | |
61 } // !irccd |