#api #assert #stream

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

#1646 in Rust patterns

Download history 1114/week @ 2025-02-05 920/week @ 2025-02-12 735/week @ 2025-02-19 845/week @ 2025-02-26 848/week @ 2025-03-05 534/week @ 2025-03-12 549/week @ 2025-03-19 1207/week @ 2025-03-26 2171/week @ 2025-04-02 956/week @ 2025-04-09 1153/week @ 2025-04-16 2122/week @ 2025-04-23 1588/week @ 2025-04-30 2813/week @ 2025-05-07 2143/week @ 2025-05-14 1648/week @ 2025-05-21

8,899 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

~520–710KB
~13K SLoC

OSZAR »