-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add test helpers to expect a sub-set of messages #1829
Add test helpers to expect a sub-set of messages #1829
Conversation
/// # } | ||
/// | ||
/// ``` | ||
pub async fn assert_received_all_expected<T, U>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub async fn assert_received_all_expected<T, U>( | |
pub async fn assert_received_unordered<T, U>( |
We could add an assert_received_ordered
later on, that will check if all the expected messages were received in that order itself. It's different from the above assert_received
method in the sense that it allows messages
to have more messages than what's provided in expected
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as suggested.
/// # } | ||
/// | ||
/// ``` | ||
pub async fn assert_received<T, U>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub async fn assert_received<T, U>( | |
pub async fn assert_received_exact<T, U>( |
As it looks for an exact match where messages
can not have anything more than expected
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds a bit too heavy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of hearts from me, thanks Didier. This is exactly what I wanted for unit tests!!!
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
a7a003d
to
08ecac0
Compare
Robot Results
Passed Tests
|
Proposed changes
Add two test helpers:
tedge_actors::test_helpers::assert_received
checks that a message box receives a list of messages, in the given order and without other messages.tedge_actors::test_helpers::assert_received_all_expected
checks that all the given messages have been received, possibly in a different order or interleaved with other messages.Types of changes
Paste Link to the issue
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments