#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

#1275 in Rust patterns

Download history 470/week @ 2024-11-15 578/week @ 2024-11-22 908/week @ 2024-11-29 678/week @ 2024-12-06 564/week @ 2024-12-13 395/week @ 2024-12-20 167/week @ 2024-12-27 665/week @ 2025-01-03 608/week @ 2025-01-10 584/week @ 2025-01-17 571/week @ 2025-01-24 1263/week @ 2025-01-31 975/week @ 2025-02-07 967/week @ 2025-02-14 734/week @ 2025-02-21 798/week @ 2025-02-28

3,656 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