()
| 218 | |
| 219 | #[test] |
| 220 | fn try_collect_multiple_errors() { |
| 221 | let iter = (0..5).map(|i| { |
| 222 | if i % 2 == 0 { |
| 223 | Ok(i) |
| 224 | } else { |
| 225 | Err(Report::new(CustomError(i))) |
| 226 | } |
| 227 | }); |
| 228 | |
| 229 | let result: Result<Vec<_>, Report<[CustomError]>> = iter.try_collect_reports(); |
| 230 | let report = result.expect_err("should have failed"); |
| 231 | |
| 232 | let contexts: BTreeSet<_> = report.current_contexts().collect(); |
| 233 | assert_eq!(contexts.len(), 2); |
| 234 | assert!(contexts.contains(&CustomError(1))); |
| 235 | assert!(contexts.contains(&CustomError(3))); |
| 236 | } |
| 237 | |
| 238 | #[test] |
| 239 | fn try_collect_multiple_errors_bounded() { |
nothing calls this directly
no test coverage detected