mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
test: Fix test by checking the actual exception instance
The BOOST_REQUIRE_THROW passes even if the command raises an exception in the underlying subprocess implementation, which might have a type derived from std::runtime_error.
This commit is contained in:
parent
160d23677a
commit
55e3dc3e03
1 changed files with 7 additions and 1 deletions
|
@ -90,7 +90,13 @@ BOOST_AUTO_TEST_CASE(run_command)
|
|||
});
|
||||
}
|
||||
{
|
||||
BOOST_REQUIRE_THROW(RunCommandParseJSON("echo \"{\""), std::runtime_error); // Unable to parse JSON
|
||||
// Unable to parse JSON
|
||||
#ifdef WIN32
|
||||
const std::string command{"cmd.exe /c echo {"};
|
||||
#else
|
||||
const std::string command{"echo {"};
|
||||
#endif
|
||||
BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, HasReason("Unable to parse JSON: {"));
|
||||
}
|
||||
// Test std::in, except for Windows
|
||||
#ifndef WIN32
|
||||
|
|
Loading…
Add table
Reference in a new issue