MCPcopy Create free account
hub / github.com/distil/diffus / example

Function example

diffus/src/diffable_impls/map.rs:57–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55
56 #[test]
57 fn example() {
58 let unity: std::collections::HashMap<_, _> =
59 [(1, 1), (2, 2), (3, 3)].iter().cloned().collect();
60 let not_unity: std::collections::HashMap<_, _> =
61 [(1, 1), (2, 3), (4, 4)].iter().cloned().collect();
62
63 if let Edit::Change(diff) = unity.diff(&not_unity) {
64 assert!(diff[&1].is_copy());
65 assert_eq!(diff[&2].change().unwrap(), &(&2, &3));
66 assert!(diff[&3].is_remove());
67 assert_eq!(diff[&4].insert().unwrap(), &4);
68 } else {
69 unreachable!()
70 }
71 }
72}

Callers

nothing calls this directly

Calls 1

diffMethod · 0.45

Tested by

no test coverage detected