MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / assert_chain

Function assert_chain

crates/core/tests/tests.rs:950–968  ·  view source on GitHub ↗
(actual: impl IntoIterator<Item = T>, expected: impl IntoIterator<Item = U>)

Source from the content-addressed store, hash-verified

948
949#[cfg(feature = "anyhow")]
950fn assert_chain<T, U>(actual: impl IntoIterator<Item = T>, expected: impl IntoIterator<Item = U>)
951where
952 T: PartialEq<U>,
953 T: fmt::Debug,
954 U: fmt::Debug,
955{
956 let mut actual = actual.into_iter();
957 let mut expected = expected.into_iter();
958 loop {
959 match (actual.next(), expected.next()) {
960 (None, None) => return,
961 (None, Some(x)) => {
962 panic!("expected {x:?} next in chain, but actual chain is exhausted")
963 }
964 (Some(x), None) => panic!("expected chain to be exhausted, but found {x:?}"),
965 (Some(x), Some(y)) => assert_eq!(x, y),
966 }
967 }
968}
969
970#[test]
971#[cfg(feature = "anyhow")]

Calls 2

into_iterMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected