Pass a reference to TestAppContext in tests

This allows us to drop the context *after* we ran all futures to
completion and that's crucial otherwise we'll never drop entities
and/or flush effects.
This commit is contained in:
Antonio Scandurra 2022-03-01 12:01:02 +01:00
parent 8390f04e7d
commit 466db69780
20 changed files with 748 additions and 819 deletions

View file

@ -2441,7 +2441,7 @@ mod tests {
use util::test::temp_tree;
#[gpui::test]
async fn test_traversal(cx: gpui::TestAppContext) {
async fn test_traversal(cx: &mut gpui::TestAppContext) {
let fs = FakeFs::new(cx.background());
fs.insert_tree(
"/root",
@ -2470,7 +2470,7 @@ mod tests {
cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
tree.read_with(&cx, |tree, _| {
tree.read_with(cx, |tree, _| {
assert_eq!(
tree.entries(false)
.map(|entry| entry.path.as_ref())
@ -2486,7 +2486,7 @@ mod tests {
}
#[gpui::test]
async fn test_rescan_with_gitignore(cx: gpui::TestAppContext) {
async fn test_rescan_with_gitignore(cx: &mut gpui::TestAppContext) {
let dir = temp_tree(json!({
".git": {},
".gitignore": "ignored-dir\n",