#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

#1567 in Rust patterns

Download history 229/week @ 2024-01-04 184/week @ 2024-01-11 227/week @ 2024-01-18 174/week @ 2024-01-25 101/week @ 2024-02-01 396/week @ 2024-02-08 92/week @ 2024-02-15 130/week @ 2024-02-22 172/week @ 2024-02-29 188/week @ 2024-03-07 391/week @ 2024-03-14 406/week @ 2024-03-21 253/week @ 2024-03-28 108/week @ 2024-04-04 282/week @ 2024-04-11 186/week @ 2024-04-18

847 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