MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / collect_map_differences

Function collect_map_differences

atomic-cli/tests/it/git_guard_cb0c_test.rs:189–211  ·  view source on GitHub ↗
(
    label: &str,
    expected: &BTreeMap<String, Vec<u8>>,
    actual: &BTreeMap<String, Vec<u8>>,
    differences: &mut Vec<String>,
)

Source from the content-addressed store, hash-verified

187}
188
189fn 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
213fn assert_snapshot_unchanged(
214 expected: &RepositorySnapshot,

Callers 1

differencesMethod · 0.70

Calls 3

contains_keyMethod · 0.80
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected