Added path_to_fail to mocking_utils in rcl
Signed-off-by: ahcorde <ahcorde@gmail.com>
This commit is contained in:
parent
7669ced71b
commit
0698835633
1 changed files with 8 additions and 0 deletions
|
@ -354,6 +354,14 @@ auto make_patch(const std::string & target, std::function<SignatureT> proxy)
|
||||||
#define patch_and_return(scope, function, return_code) \
|
#define patch_and_return(scope, function, return_code) \
|
||||||
patch(scope, function, [&](auto && ...) {return return_code;})
|
patch(scope, function, [&](auto && ...) {return return_code;})
|
||||||
|
|
||||||
|
/// Patch a `function` to always yield a given `return_code` in a given `scope`.
|
||||||
|
#define patch_to_fail(scope, function, error_message, return_code) \
|
||||||
|
patch( \
|
||||||
|
scope, function, [&](auto && ...) { \
|
||||||
|
RCUTILS_SET_ERROR_MSG(error_message); \
|
||||||
|
return return_code; \
|
||||||
|
})
|
||||||
|
|
||||||
/// Patch a `function` to execute normally but always yield a given `return_code`
|
/// Patch a `function` to execute normally but always yield a given `return_code`
|
||||||
/// in a given `scope`.
|
/// in a given `scope`.
|
||||||
#define inject_on_return(scope, function, return_code) \
|
#define inject_on_return(scope, function, return_code) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue