Merge bitcoin/bitcoin#26377: test: Make system_tests/run_command test locale and platform agnostic

884304e6c6 test: Make `system_tests/run_command` locale agnostic (Hennadii Stepanov)

Pull request description:

  Fixes bitcoin/bitcoin#26368.

ACKs for top commit:
  Sjors:
    tACK 884304e6c6

Tree-SHA512: 76d4941e02b3b119dcf4dacbe60ef45a9dc8cf775bdb31b5291cd8147665285d41caaf1f5688abdfc9a47c393ddb535af7b11af839660d30ef30f1ca0d936133
This commit is contained in:
MacroFake 2022-10-28 11:31:43 +02:00
commit 1bad29fe02
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -51,15 +51,9 @@ BOOST_AUTO_TEST_CASE(run_command)
}
{
// An invalid command is handled by Boost
#ifdef WIN32
const std::string expected{"The system cannot find the file specified."};
#else
const std::string expected{"No such file or directory"};
#endif
BOOST_CHECK_EXCEPTION(RunCommandParseJSON("invalid_command"), boost::process::process_error, [&](const boost::process::process_error& e) {
const std::string what(e.what());
BOOST_CHECK(what.find("RunCommandParseJSON error:") == std::string::npos);
BOOST_CHECK(what.find(expected) != std::string::npos);
BOOST_CHECK(std::string(e.what()).find("RunCommandParseJSON error:") == std::string::npos);
BOOST_CHECK_EQUAL(e.code().value(), 2);
return true;
});
}