test: compare the cut tests' documents without their creation stamps

This commit is contained in:
bflatastic
2026-11-20 21:03:02 +07:00
parent aa78136bbf
commit ee615073fe
2 changed files with 1157 additions and 1151 deletions
+7 -1
View File
@@ -114,7 +114,13 @@ fn tree(d: &Document) -> Vec<(usize, NodeId)> {
fn assert_same(a: &Session, b: &Session, when: &str) {
let (x, y) = (a.doc().unwrap(), b.doc().unwrap());
assert_eq!(tree(&x.doc), tree(&y.doc), "{when}: the tree");
assert!(*x.doc == *y.doc, "{when}: the document");
// `file.new` stamps each document with the second it was made, and the two can be a second apart.
let unstamped = |d: &Document| {
let mut d = d.clone();
d.metadata.created = None;
d
};
assert!(unstamped(&x.doc) == unstamped(&y.doc), "{when}: the document");
assert_eq!(x.selection, y.selection, "{when}: the selection");
// Each session's document has its own uid; the clipboard names the one it came from.
assert_eq!(a.clipboard.source_doc.is_some(), b.clipboard.source_doc.is_some(), "{when}: the clipboard's source");
File diff suppressed because it is too large Load Diff