9 #ifdef ENABLE_EXTERNAL_SIGNER 13 #pragma GCC diagnostic push 14 #pragma GCC diagnostic ignored "-Wnarrowing" 16 #include <boost/process.hpp> 18 #pragma GCC diagnostic pop 20 #endif // ENABLE_EXTERNAL_SIGNER 22 #include <boost/test/unit_test.hpp> 33 #ifdef ENABLE_EXTERNAL_SIGNER 55 const std::string expected{
"The system cannot find the file specified."};
57 const std::string expected{
"No such file or directory"};
59 BOOST_CHECK_EXCEPTION(
RunCommandParseJSON(
"invalid_command"), boost::process::process_error, [&](
const boost::process::process_error& e) {
60 const std::string what(e.what());
61 BOOST_CHECK(what.find(
"RunCommandParseJSON error:") == std::string::npos);
62 BOOST_CHECK(what.find(expected) != std::string::npos);
69 const std::string
command{
"cmd.exe /c call"};
71 const std::string
command{
"false"};
74 BOOST_CHECK(std::string(e.what()).find(
strprintf(
"RunCommandParseJSON error: process(%s) returned 1: \n",
command)) != std::string::npos);
81 const std::string
command{
"cmd.exe /c dir nosuchfile"};
82 const std::string expected{
"File Not Found"};
84 const std::string
command{
"ls nosuchfile"};
85 const std::string expected{
"No such file or directory"};
88 const std::string what(e.what());
90 BOOST_CHECK(what.find(expected) != std::string::npos);
108 #endif // ENABLE_EXTERNAL_SIGNER UniValue RunCommandParseJSON(const std::string &str_command, const std::string &str_std_in)
Execute a command which returns JSON, and parse the result.
const UniValue & find_value(const UniValue &obj, const std::string &name)
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
BOOST_AUTO_TEST_CASE(dummy)
#define BOOST_CHECK(expr)