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
22 #include <boost/test/unit_test.hpp>
33 #ifdef ENABLE_EXTERNAL_SIGNER
39 auto hntdll = GetModuleHandleA(
"ntdll.dll");
41 const bool wine_runtime = GetProcAddress(hntdll,
"wine_get_version");
62 const int expected_error{wine_runtime ? 6 : 2};
64 const int expected_error{2};
66 BOOST_CHECK_EXCEPTION(
RunCommandParseJSON(
"invalid_command"), boost::process::process_error, [&](
const boost::process::process_error& e) {
67 BOOST_CHECK(std::string(e.what()).find(
"RunCommandParseJSON error:") == std::string::npos);
75 const std::string
command{
"cmd.exe /c exit 1"};
77 const std::string
command{
"false"};
80 const std::string what{e.what()};
88 const std::string
command{
"cmd.exe /c dir nosuchfile"};
89 const std::string expected{wine_runtime ?
"File not found." :
"File Not Found"};
91 const std::string
command{
"ls nosuchfile"};
92 const std::string expected{
"No such file or directory"};
95 const std::string what(e.what());
97 BOOST_CHECK(what.find(expected) != std::string::npos);
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
UniValue RunCommandParseJSON(const std::string &str_command, const std::string &str_std_in)
Execute a command which returns JSON, and parse the result.
BOOST_AUTO_TEST_CASE(dummy)
const UniValue & find_value(const UniValue &obj, const std::string &name)