(
label: &str,
expected: &BTreeMap<String, Vec<u8>>,
actual: &BTreeMap<String, Vec<u8>>,
differences: &mut Vec<String>,
)
| 187 | } |
| 188 | |
| 189 | fn collect_map_differences( |
| 190 | label: &str, |
| 191 | expected: &BTreeMap<String, Vec<u8>>, |
| 192 | actual: &BTreeMap<String, Vec<u8>>, |
| 193 | differences: &mut Vec<String>, |
| 194 | ) { |
| 195 | for (path, expected_bytes) in expected { |
| 196 | match actual.get(path) { |
| 197 | None => differences.push(format!("{label}/{path} was removed")), |
| 198 | Some(actual_bytes) if actual_bytes != expected_bytes => differences.push(format!( |
| 199 | "{label}/{path} changed ({} -> {} bytes)", |
| 200 | expected_bytes.len(), |
| 201 | actual_bytes.len() |
| 202 | )), |
| 203 | Some(_) => {} |
| 204 | } |
| 205 | } |
| 206 | for path in actual.keys() { |
| 207 | if !expected.contains_key(path) { |
| 208 | differences.push(format!("{label}/{path} was added")); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | fn assert_snapshot_unchanged( |
| 214 | expected: &RepositorySnapshot, |
no test coverage detected