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)
28
28
29
29
#ifdef ENABLE_EXTERNAL_SIGNER
30
30
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
-
40
31
BOOST_AUTO_TEST_CASE (run_command)
41
32
{
42
33
{
@@ -56,7 +47,17 @@ BOOST_AUTO_TEST_CASE(run_command)
56
47
}
57
48
{
58
49
// 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
+ });
60
61
}
61
62
{
62
63
// Return non-zero exit code, no output to stderr
You can’t perform that action at this time.
0 commit comments