From fecdb974ff0ae8736cd7da3da30e5fc35c23b915 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Thu, 22 Oct 2026 22:42:11 +0800 Subject: [PATCH] test: Fix Unix-only assumptions in ide-build tests; run all tests in CI The Gradle and Maven tests expected the Unix wrapper and command names, and the canonical-root test uses Unix absolute paths. CI now reports every failing test instead of stopping at the first few. Claude-Session: https://claude.ai/code/session_01B65qLEKnkeYTGdbwhLpjCu --- .github/workflows/ci.yml | 2 +- crates/ide-build/src/compile/mod.rs | 2 ++ crates/ide-build/src/gradle.rs | 5 +++-- crates/ide-build/src/maven.rs | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60ad34fa..c48701c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - if: runner.os == 'Linux' run: cargo fmt --all --check - run: cargo clippy --workspace --all-targets -- -D warnings - - run: cargo nextest run --workspace + - run: cargo nextest run --workspace --no-fail-fast - name: Bindings are up to date if: runner.os == 'Linux' run: pnpm gen:bindings && git diff --exit-code src/bindings.ts diff --git a/crates/ide-build/src/compile/mod.rs b/crates/ide-build/src/compile/mod.rs index a79466d4..20f12d62 100644 --- a/crates/ide-build/src/compile/mod.rs +++ b/crates/ide-build/src/compile/mod.rs @@ -735,6 +735,8 @@ mod tests { assert_eq!(identifier_len("x é_1 c", 2), 3); } + // Uses Unix absolute paths for the canonical root. + #[cfg(unix)] #[test] fn resolves_paths_against_cwd_and_canonical_root() { let tmp = tempfile::tempdir().unwrap(); diff --git a/crates/ide-build/src/gradle.rs b/crates/ide-build/src/gradle.rs index be4d8eb5..a0e8661a 100644 --- a/crates/ide-build/src/gradle.rs +++ b/crates/ide-build/src/gradle.rs @@ -406,7 +406,8 @@ Pattern: clean: Cleans the output files of a task. std::fs::write(root.join("settings.gradle.kts"), "rootProject.name = \"demo\"\ninclude(\"app\")").unwrap(); std::fs::create_dir_all(root.join("app")).unwrap(); std::fs::write(root.join("app/build.gradle.kts"), "plugins { application }").unwrap(); - std::fs::write(root.join("gradlew"), "#!/bin/sh").unwrap(); + let wrapper = if cfg!(windows) { "gradlew.bat" } else { "gradlew" }; + std::fs::write(root.join(wrapper), "#!/bin/sh").unwrap(); let m = load(root).unwrap(); assert_eq!(m.dir, ""); let ps: Vec<(&str, &str, &str, Option<&str>)> = m @@ -418,7 +419,7 @@ Pattern: clean: Cleans the output files of a task. assert!(m.projects[0].tasks.iter().any(|t| t.name == "wrapper")); assert!(!m.projects[0].tasks.iter().any(|t| t.name == "build")); assert!(m.projects[1].tasks.iter().any(|t| t.name == "run" && t.group == "application")); - assert!(m.command.ends_with("gradlew")); + assert!(m.command.ends_with(wrapper)); assert_eq!(build_files(root, &m).len(), 2); assert_eq!(m.java_version, None); assert_eq!( diff --git a/crates/ide-build/src/maven.rs b/crates/ide-build/src/maven.rs index 88eed0e1..2ea123b3 100644 --- a/crates/ide-build/src/maven.rs +++ b/crates/ide-build/src/maven.rs @@ -1163,7 +1163,7 @@ mod tests { let profiles: Vec<(&str, bool)> = model.profiles.iter().map(|p| (p.id.as_str(), p.active_by_default)).collect(); assert_eq!(profiles, [("dev", true), ("extra", false)]); assert_eq!(parent.profiles, ["dev", "extra"]); - assert!(model.projects.iter().all(|p| p.command == "mvn")); + assert!(model.projects.iter().all(|p| p.command == if cfg!(windows) { "mvn.cmd" } else { "mvn" })); } #[test]