Skip to content

Commit 0aad33d

Browse files
committed
test: Fix "false" subtest in system_tests for Windows
1 parent 507c009 commit 0aad33d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/test/system_tests.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ bool checkMessage(const std::runtime_error& ex)
3737
return true;
3838
}
3939

40-
bool checkMessageFalse(const std::runtime_error& ex)
41-
{
42-
BOOST_CHECK_EQUAL(ex.what(), std::string("RunCommandParseJSON error: process(false) returned 1: \n"));
43-
return true;
44-
}
45-
4640
bool checkMessageStdErr(const std::runtime_error& ex)
4741
{
4842
const std::string what(ex.what());
@@ -73,7 +67,15 @@ BOOST_AUTO_TEST_CASE(run_command)
7367
}
7468
{
7569
// Return non-zero exit code, no output to stderr
76-
BOOST_CHECK_EXCEPTION(RunCommandParseJSON("false"), std::runtime_error, checkMessageFalse);
70+
#ifdef WIN32
71+
const std::string command{"cmd.exe /c call"};
72+
#else
73+
const std::string command{"false"};
74+
#endif
75+
BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, [&](const std::runtime_error& e) {
76+
BOOST_CHECK(std::string(e.what()).find(strprintf("RunCommandParseJSON error: process(%s) returned 1: \n", command)) != std::string::npos);
77+
return true;
78+
});
7779
}
7880
{
7981
// Return non-zero exit code, with error message for stderr

0 commit comments

Comments
 (0)