diff options
author | Andrew Chow <github@achow101.com> | 2023-12-06 10:27:27 -0500 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-12-06 10:33:29 -0500 |
commit | 9693cfa0a422030147cd4a57d3da92749d1b0e95 (patch) | |
tree | 1f5238231963b6bf5b802b7cb4b1605ef52b45da /contrib/debian | |
parent | dde7ac5c704688c8a9af29bd07e5ae8114824ce7 (diff) | |
parent | 55e3dc3e03510e97caba1547a82e3e022b0bbd42 (diff) |
Merge bitcoin/bitcoin#28989: test: Fix test by checking the actual exception instance
55e3dc3e03510e97caba1547a82e3e022b0bbd42 test: Fix test by checking the actual exception instance (Hennadii Stepanov)
Pull request description:
The `system_tests/run_command` test is broken because it passes even with the diff as follows:
```diff
--- a/src/test/system_tests.cpp
+++ b/src/test/system_tests.cpp
@@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(run_command)
});
}
{
- BOOST_REQUIRE_THROW(RunCommandParseJSON("echo \"{\""), std::runtime_error); // Unable to parse JSON
+ BOOST_REQUIRE_THROW(RunCommandParseJSON("invalid_command \"{\""), std::runtime_error); // Unable to parse JSON
}
// Test std::in, except for Windows
#ifndef WIN32
```
The reason of such fragility is that the [`BOOST_REQUIRE_THROW`](https://www.boost.org/doc/libs/1_83_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level_throw.html) macro passes even if the command raises an exception in the underlying subprocess implementation, which might have a type derived from `std::runtime_error`.
ACKs for top commit:
maflcko:
lgtm ACK 55e3dc3e03510e97caba1547a82e3e022b0bbd42
achow101:
ACK 55e3dc3e03510e97caba1547a82e3e022b0bbd42
furszy:
Non-Windows code ACK 55e3dc3e
pablomartin4btc:
ACK 55e3dc3e03510e97caba1547a82e3e022b0bbd42
Tree-SHA512: 32f49421bdcc94744c81e82dc10cfa02e3f8ed111974edf1c2a47bdaeb56d7baec1bede67301cc89464fba613029ecb131dedc6bc5948777ab52f0f12df8bfe9
Diffstat (limited to 'contrib/debian')
0 files changed, 0 insertions, 0 deletions