#testing #api-testing #stream #macro #assertions

dev stream_assert

Macros to simplify testing of Stream based APIs

2 releases

0.1.1 Sep 6, 2023
0.1.0 May 30, 2023

#32 in #api-testing

Download history 430/week @ 2024-06-17 472/week @ 2024-06-24 481/week @ 2024-07-01 550/week @ 2024-07-08 483/week @ 2024-07-15 698/week @ 2024-07-22 358/week @ 2024-07-29 516/week @ 2024-08-05 277/week @ 2024-08-12 451/week @ 2024-08-19 393/week @ 2024-08-26 432/week @ 2024-09-02 430/week @ 2024-09-09 430/week @ 2024-09-16 425/week @ 2024-09-23 562/week @ 2024-09-30

1,865 downloads per month
Used in 8 crates

MPL-2.0 license

8KB
77 lines

stream_assert

Macros to simplify testing of Stream based APIs.

Provides the following assertion macros:

// Assert that the next value is ready and equal to the given expression.
assert_next_eq!(stream, expression);

// Assert that the next value is ready and matches the given pattern.
assert_next_matches!(stream, Enum::Variant { field: 1, .. });

// Assert that the stream is not ready (`poll_next` returns `Pending`).
assert_pending!(stream);

// Assert that the stream is closed (`poll_next` returns `Ready(None)`).
assert_closed!(stream);

Dependencies

~530–710KB
~14K SLoC