(actual: impl IntoIterator<Item = T>, expected: impl IntoIterator<Item = U>)
| 948 | |
| 949 | #[cfg(feature = "anyhow")] |
| 950 | fn assert_chain<T, U>(actual: impl IntoIterator<Item = T>, expected: impl IntoIterator<Item = U>) |
| 951 | where |
| 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")] |
no test coverage detected