irccd  3.0.3
Public Types | Public Member Functions | Protected Attributes | List of all members
irccd::test::cli_fixture Class Reference

Test fixture for irccdctl frontend. More...

#include <cli_fixture.hpp>

Public Types

using outputs = std::vector< std::string >
 
using result = std::tuple< int, outputs, outputs >
 

Public Member Functions

 cli_fixture (std::string irccdctl)
 
 ~cli_fixture ()
 
void start ()
 
auto exec (const std::vector< std::string > &args) -> result
 

Protected Attributes

daemon::bot bot_ {service_}
 
std::shared_ptr< mock_serverserver_
 

Detailed Description

Test fixture for irccdctl frontend.

This class will run irccd daemon in a thread when member function start is called.

Before starting the daemon, the test can manually modify irccd instance through bot_ member variable. Once started, call exec with arguments you want to pass through irccdctl utility.

Member Typedef Documentation

◆ outputs

using irccd::test::cli_fixture::outputs = std::vector<std::string>

Type for all lines printed.

◆ result

Collection of output from stdout/stderr respectively.

Constructor & Destructor Documentation

◆ cli_fixture()

irccd::test::cli_fixture::cli_fixture ( std::string  irccdctl)

Construct and initialize and irccd daemon running in a thread.

Parameters
irccdctlpath to irccdctl

◆ ~cli_fixture()

irccd::test::cli_fixture::~cli_fixture ( )

Stop irccd and close everything.

Member Function Documentation

◆ exec()

auto irccd::test::cli_fixture::exec ( const std::vector< std::string > &  args) -> result

Execute irccdctl.

Parameters
argsthe arguments to irccdctl
Returns
the stdout/stderr and exit code

◆ start()

void irccd::test::cli_fixture::start ( )

Start irccd daemon.

A thread will be running and closed when the destructor is called, you MUST not modify irccd while running.

Member Data Documentation

◆ bot_

daemon::bot irccd::test::cli_fixture::bot_ {service_}
protected

Irccd instance.

Warning
Do not modify once start() has been called.

◆ server_

std::shared_ptr<mock_server> irccd::test::cli_fixture::server_
protected

Server automatically added as "test".


The documentation for this class was generated from the following file: