Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Better multibuffer tests

Kirill Bulatov7334bdccbff6
diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rs
index b5ccdb4f2d9..70cccf21da3 100644
--- a/crates/editor/src/inlay_hint_cache.rs
+++ b/crates/editor/src/inlay_hint_cache.rs
@@ -2001,7 +2001,7 @@ mod tests {
});
}
- #[gpui::test]
+ #[gpui::test(iterations = 10)]
async fn test_multiple_excerpts_large_multibuffer(
deterministic: Arc<Deterministic>,
cx: &mut gpui::TestAppContext,
@@ -2335,10 +2335,12 @@ mod tests {
all hints should be invalidated and requeried for all of its visible excerpts"
);
assert_eq!(expected_layers, visible_hint_labels(editor, cx));
- assert_eq!(
- editor.inlay_hint_cache().version,
- last_scroll_update_version + expected_layers.len(),
- "Due to every excerpt having one hint, cache should update per new excerpt received"
+
+ let current_cache_version = editor.inlay_hint_cache().version;
+ let minimum_expected_version = last_scroll_update_version + expected_layers.len();
+ assert!(
+ current_cache_version == minimum_expected_version || current_cache_version == minimum_expected_version + 1,
+ "Due to every excerpt having one hint, cache should update per new excerpt received + 1 potential sporadic update"
);
});
}