File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -28,15 +28,6 @@ BOOST_AUTO_TEST_CASE(dummy)
2828
2929#ifdef ENABLE_EXTERNAL_SIGNER
3030
31- bool checkMessage (const std::runtime_error& ex)
32- {
33- // On Linux & Mac: "No such file or directory"
34- // On Windows: "The system cannot find the file specified."
35- const std::string what (ex.what ());
36- BOOST_CHECK (what.find (" file" ) != std::string::npos);
37- return true ;
38- }
39-
4031BOOST_AUTO_TEST_CASE (run_command)
4132{
4233 {
@@ -56,7 +47,17 @@ BOOST_AUTO_TEST_CASE(run_command)
5647 }
5748 {
5849 // An invalid command is handled by Boost
59- BOOST_CHECK_EXCEPTION (RunCommandParseJSON (" invalid_command" ), boost::process::process_error, checkMessage); // Command failed
50+ #ifdef WIN32
51+ const std::string expected{" The system cannot find the file specified." };
52+ #else
53+ const std::string expected{" No such file or directory" };
54+ #endif
55+ BOOST_CHECK_EXCEPTION (RunCommandParseJSON (" invalid_command" ), boost::process::process_error, [&](const boost::process::process_error& e) {
56+ const std::string what (e.what ());
57+ BOOST_CHECK (what.find (" RunCommandParseJSON error:" ) == std::string::npos);
58+ BOOST_CHECK (what.find (expected) != std::string::npos);
59+ return true ;
60+ });
6061 }
6162 {
6263 // Return non-zero exit code, no output to stderr
You can’t perform that action at this time.
0 commit comments