rust-embedded / rust-embedded/embedded-hal-mock
Make it possible to have a test wait for other thread to consume a mock
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 146
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Sometimes the code you are unit testing is threaded. It is useful to have a mechanism to wait for mocks to be consumed to avoid having to do white-box testing where you alter your production code to know when something is completed by the thread.
I suggest adding a function called wait_for_consumption() which takes a Duration as a timeout. It should block until expectations have been consumed or panic if the timeout is reached.
I made a pull request for this: https://github.com/dbrgn/embedded-hal-mock/pull/138
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review pull request #138 and the existing mock expectation-consumption handling first. Confirm that wait_for_consumption(Duration) blocks until expectations are consumed and panics when the timeout is reached, using the repository's tests to verify the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100