From 3f6feb1c12fe9f8ad89198c5cbc1c0fb03d9bffd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 16 Feb 2022 13:39:55 +0100 Subject: [PATCH] Compare only snapshot's essential state in random collaboration test --- crates/project/src/worktree.rs | 4 ++-- crates/server/src/rpc.rs | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index effba2f9c39c3af80d87789d2311c3f0a5883ba5..4ac5a103ed3206d5f6a063b7ad0f8d2cd49fd682 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -88,7 +88,7 @@ pub struct RemoteWorktree { pending_updates: VecDeque, } -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone)] pub struct Snapshot { id: WorktreeId, root_name: String, @@ -1668,7 +1668,7 @@ impl sum_tree::Summary for EntrySummary { } } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug)] struct PathEntry { id: usize, path: Arc, diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 100b14d9da27b1f0392dd113fec808e647cde8a2..28aa077aa84102be0fc4c441e4d04cf061b21eaa 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -3682,11 +3682,21 @@ mod tests { "guest {} has different worktrees than the host", ix ); - for (id, snapshot) in &host_worktree_snapshots { + for (id, host_snapshot) in &host_worktree_snapshots { + let guest_snapshot = &worktree_snapshots[id]; assert_eq!( - worktree_snapshots[id], *snapshot, + guest_snapshot.root_name(), + host_snapshot.root_name(), + "guest {} has different root name than the host for worktree {}", + ix, + id + ); + assert_eq!( + guest_snapshot.entries(false).collect::>(), + host_snapshot.entries(false).collect::>(), "guest {} has different snapshot than the host for worktree {}", - ix, id + ix, + id ); }