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.

Fix running vim tests with --features neovim (#36014)

Conrad Irwin1a798830cb23
diff --git a/Cargo.lock b/Cargo.lock
index 8a3e319a574..8d22eeafab5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -18025,6 +18025,7 @@ dependencies = [
"command_palette_hooks",
"db",
"editor",
+ "env_logger 0.11.8",
"futures 0.3.31",
"git_ui",
"gpui",
diff --git a/crates/gpui_macros/src/test.rs b/crates/gpui_macros/src/test.rs
index 2c521498971..adb27f42ea2 100644
--- a/crates/gpui_macros/src/test.rs
+++ b/crates/gpui_macros/src/test.rs
@@ -167,6 +167,7 @@ fn generate_test_function(
));
cx_teardowns.extend(quote!(
dispatcher.run_until_parked();
+ #cx_varname.executor().forbid_parking();
#cx_varname.quit();
dispatcher.run_until_parked();
));
@@ -232,7 +233,7 @@ fn generate_test_function(
cx_teardowns.extend(quote!(
drop(#cx_varname_lock);
dispatcher.run_until_parked();
- #cx_varname.update(|cx| { cx.quit() });
+ #cx_varname.update(|cx| { cx.background_executor().forbid_parking(); cx.quit(); });
dispatcher.run_until_parked();
));
continue;
@@ -247,6 +248,7 @@ fn generate_test_function(
));
cx_teardowns.extend(quote!(
dispatcher.run_until_parked();
+ #cx_varname.executor().forbid_parking();
#cx_varname.quit();
dispatcher.run_until_parked();
));
diff --git a/crates/vim/Cargo.toml b/crates/vim/Cargo.toml
index 9fb5c46564a..434b14b07cd 100644
--- a/crates/vim/Cargo.toml
+++ b/crates/vim/Cargo.toml
@@ -24,6 +24,7 @@ command_palette.workspace = true
command_palette_hooks.workspace = true
db.workspace = true
editor.workspace = true
+env_logger.workspace = true
futures.workspace = true
gpui.workspace = true
itertools.workspace = true
diff --git a/crates/vim/src/test/vim_test_context.rs b/crates/vim/src/test/vim_test_context.rs
index b8988b1d1f5..904e48e5a3e 100644
--- a/crates/vim/src/test/vim_test_context.rs
+++ b/crates/vim/src/test/vim_test_context.rs
@@ -15,6 +15,7 @@ impl VimTestContext {
if cx.has_global::<VimGlobals>() {
return;
}
+ env_logger::try_init().ok();
cx.update(|cx| {
let settings = SettingsStore::test(cx);
cx.set_global(settings);