Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

will_set_contents_of_parameter() should save the data #294

Open
thoni56 opened this issue Mar 23, 2022 · 0 comments
Open

will_set_contents_of_parameter() should save the data #294

thoni56 opened this issue Mar 23, 2022 · 0 comments

Comments

@thoni56
Copy link
Contributor

thoni56 commented Mar 23, 2022

I often get bit by the issue that the data pointed to when calling will_set_contents_of_parameter(<parameter>, pointer_to_data, length) has to be retained until the actual call to the mock. This is documented but it would be much better if this wasn't an issue at all.

The expectation is probably that once the expect() has run you can forget about it, which is not the case.

I think it would be possible to memcpy() the data to an allocated area held by the expectation/constraint. This way it is saved from destruction until it is needed, used and discarded.

@thoni56 thoni56 changed the title will_set will_set_contents_od_parameter() should save the data Mar 23, 2022
@thoni56 thoni56 changed the title will_set_contents_od_parameter() should save the data will_set_contents_of_parameter() should save the data Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant