#stream #testing #macro #assertions #api

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

#1805 in Rust patterns

Download history 350/week @ 2024-03-13 460/week @ 2024-03-20 237/week @ 2024-03-27 132/week @ 2024-04-03 281/week @ 2024-04-10 176/week @ 2024-04-17 175/week @ 2024-04-24 337/week @ 2024-05-01 225/week @ 2024-05-08 290/week @ 2024-05-15 528/week @ 2024-05-22 429/week @ 2024-05-29 394/week @ 2024-06-05 526/week @ 2024-06-12 403/week @ 2024-06-19 512/week @ 2024-06-26

1,914 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

~715KB
~14K SLoC