| 141 | |
| 142 | #[track_caller] |
| 143 | fn assert<I, P>(path: &path::Path, pred: I) |
| 144 | where |
| 145 | I: IntoPathPredicate<P>, |
| 146 | P: predicates_core::Predicate<path::Path>, |
| 147 | { |
| 148 | let pred = pred.into_path(); |
| 149 | if let Some(case) = pred.find_case(false, path) { |
| 150 | let palette = crate::Palette::color(); |
| 151 | panic!( |
| 152 | "Unexpected file, failed {:#}\n{:#}={:#}", |
| 153 | case.tree(), |
| 154 | palette.key("path"), |
| 155 | palette.value(path.display()) |
| 156 | ); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | /// Used by [`PathAssert`] to convert Self into the needed [`predicates_core::Predicate<Path>`]. |
| 161 | /// |