-
-
Notifications
You must be signed in to change notification settings - Fork 294
Description
It would be nice to have something like array_size_name
for argument name patterns that would be ignored by a new expect wrapper.
For example if one uses a _o
suffix for output-only arguments, the pattern could be set to _o$
to avoid the _IgnoreArg_whatever_o()
calls on every expect, and the expect wrapper wouldn't need a dummy value (that gets ignored).
The default should be an empty list for backwards compatiblity. As there would still be the "regular way" this wouldn't need to cover every single possibility, but can only cover the most common usecases.
Users can already use macros to do this themselves, but that requires doing it individually for all relevant functions.
How I envision it:
// function
bool parse_data(const void* input, uint32_t* return_o);
// expect - current
parse_data_ExpectAndReturn(dummy_data, NULL /* ignored */, true);
parse_data_IgnoreArg_return_o(dummy_data);
const uint32_t return_val = 1234;
parse_data_ReturnThruPtr_return_o(&return_val);
// expect - basic idea
parse_data_ExpectWithoutOutputAndReturn(dummy_data, true);
const uint32_t return_val = 1234;
parse_data_ReturnThruPtr_return_o(&return_val);
// expect - optimal (but likely too complicated)
const uint32_t return_val = 1234;
parse_data_ExpectAndReturnThruOutputArgs(dummy_data, &return_val, true);
I am not sure how to best implement config, parsing and mock initialisation.