Visual Studio Code, rebuilt in Rust
Rust
test(search): run the sh stand-in for ripgrep on Unix only
rokartur1f2ae36004af
diff --git a/native/crates/search/src/file_search.rs b/native/crates/search/src/file_search.rsindex 94f5a0afe86..5827b69904d 100644--- a/native/crates/search/src/file_search.rs+++ b/native/crates/search/src/file_search.rs@@ -497,6 +497,7 @@ mod tests {assert_eq!(prepare_query_lowercase("Ma*in \"x\"#"), "mainx");}+ #[cfg(unix)]#[test]fn too_many_symlink_loops_list_the_folder_again_without_following_them() {let lines = |paths: &[&str]| paths.iter().map(|path| path.to_string()).collect::<Vec<_>>();diff --git a/native/crates/search/src/ripgrep.rs b/native/crates/search/src/ripgrep.rsindex 24583eeacec..7bc4bc39a5e 100644--- a/native/crates/search/src/ripgrep.rs+++ b/native/crates/search/src/ripgrep.rs@@ -209,8 +209,9 @@ fn escape_aware_split(pattern: &str) -> Split {}/// A folder with an `rg` script standing in for ripgrep: with `--follow` it prints `followed`, then more than-/// `MAX_SYMLINK_LOOPS` loop errors, then hangs until killed; without it prints `unfollowed`.-#[cfg(test)]+/// `MAX_SYMLINK_LOOPS` loop errors, then hangs until killed; without it prints `unfollowed`. A `/bin/sh` script, so+/// Unix only.+#[cfg(all(test, unix))]pub(crate) fn rg_with_symlink_loops(name: &str, followed: &[String], unfollowed: &[String]) -> PathBuf {use std::os::unix::fs::PermissionsExt;let folder = std::env::temp_dir().join(format!("search-{name}-{}", std::process::id()));@@ -231,6 +232,7 @@ pub(crate) fn rg_with_symlink_loops(name: &str, followed: &[String], unfollowed:mod tests {use super::*;+ #[cfg(unix)]#[test]fn too_many_symlink_loops_kill_a_run_that_follows_them() {let folder = rg_with_symlink_loops("ripgrep-loops", &["a.txt".into()], &[]);diff --git a/native/crates/search/src/text_search.rs b/native/crates/search/src/text_search.rsindex 424b751b465..83895797376 100644--- a/native/crates/search/src/text_search.rs+++ b/native/crates/search/src/text_search.rs@@ -967,6 +967,7 @@ mod tests {);}+ #[cfg(unix)]#[test]fn too_many_symlink_loops_search_the_folder_again_without_following_them() {let first = [rg_match("a.txt", "foo", 1, &[(0, 3)])];