diff --git a/backup/src/delta.rs b/backup/src/delta.rs index 85b36a0..cc831ac 100644 --- a/backup/src/delta.rs +++ b/backup/src/delta.rs @@ -230,4 +230,16 @@ mod tests { assert_eq!(expected, a.union(&b)); assert_eq!(expected, b.union(&a)); } + + #[test] + fn test_union_full_revert() { + let a = Delta::default().with_added("dir_1", ["file1", "file2"]); + let b = Delta::default().with_removed("dir_1", ["file1", "file2"]); + + let expected = Delta::default().with_removed("dir_1", ["file1", "file2"]); + assert_eq!(expected, a.union(&b)); + + let expected = Delta::default().with_added("dir_1", ["file1", "file2"]); + assert_eq!(expected, b.union(&a)); + } }