From ca052b4a4d809ec12ea845c0a568717508a7ae45 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 12 Feb 2022 12:37:51 +0100 Subject: [PATCH] Make `test_propagate_saves_and_fs_changes` more robust ...by using a condition that awaits on the actual paths as opposed to the simple file counts. --- crates/server/src/rpc.rs | 43 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 5704a787b9397ef5bb0f4385ee586bedcb692f9d..6d62a0e8d9f7bd3653ef3bb363aef1d236fe3957 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -1629,38 +1629,29 @@ mod tests { .unwrap(); worktree_a - .condition(&cx_a, |tree, _| tree.file_count() == 4) - .await; - worktree_b - .condition(&cx_b, |tree, _| tree.file_count() == 4) - .await; - worktree_c - .condition(&cx_c, |tree, _| tree.file_count() == 4) - .await; - worktree_a.read_with(&cx_a, |tree, _| { - assert_eq!( + .condition(&cx_a, |tree, _| { tree.paths() .map(|p| p.to_string_lossy()) - .collect::>(), - &[".zed.toml", "file1-renamed", "file3", "file4"] - ) - }); - worktree_b.read_with(&cx_b, |tree, _| { - assert_eq!( + .collect::>() + == [".zed.toml", "file1-renamed", "file3", "file4"] + }) + .await; + worktree_b + .condition(&cx_b, |tree, _| { tree.paths() .map(|p| p.to_string_lossy()) - .collect::>(), - &[".zed.toml", "file1-renamed", "file3", "file4"] - ) - }); - worktree_c.read_with(&cx_c, |tree, _| { - assert_eq!( + .collect::>() + == [".zed.toml", "file1-renamed", "file3", "file4"] + }) + .await; + worktree_c + .condition(&cx_c, |tree, _| { tree.paths() .map(|p| p.to_string_lossy()) - .collect::>(), - &[".zed.toml", "file1-renamed", "file3", "file4"] - ) - }); + .collect::>() + == [".zed.toml", "file1-renamed", "file3", "file4"] + }) + .await; // Ensure buffer files are updated as well. buffer_a