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