From e3f8932e2160060d879bee9dbfc7d696780e8611 Mon Sep 17 00:00:00 2001 From: arookieofc <2128194521@qq.com> Date: Mon, 2 Nov 2026 20:07:48 +0800 Subject: [PATCH] test(sdk): match the too-old-JDK path as test_jdk writes it (#840) The jdtls server-JDK test asserted the "/jdk21" literal, but test_jdk now materializes real fixture directories, so the message carries platform-native separators and the assertion failed on Windows. Match the fixture's own home path instead. Co-authored-by: a-rookie-of-C-language <186315048+a-rookie-of-C-language@users.noreply.github.com> --- crates/ide-sdk/src/java.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ide-sdk/src/java.rs b/crates/ide-sdk/src/java.rs index 23835c3d9..56d81ecf7 100644 --- a/crates/ide-sdk/src/java.rs +++ b/crates/ide-sdk/src/java.rs @@ -1047,10 +1047,14 @@ mod tests { assert_eq!(cfg.env["JAVA_HOME"], fixtures.path().join("opt/own-jdk").to_string_lossy()); // Too old for this jdtls: the user's choice is not overridden, it is explained. - let cfg = run(Some(&jdk(21, "/jdk21")), 25); + let old = jdk(21, "/jdk21"); + let cfg = run(Some(&old), 25); assert!(!cfg.env.contains_key("JAVA_HOME")); let err = cfg.launch_error.unwrap(); - assert!(err.contains("/jdk21") && err.contains("JDK 25 or newer"), "{err}"); + // The message embeds jdk.home as written to disk, so match that instead of the + // "/jdk21" literal: its separators are platform-native since test_jdk + // materializes real directories. + assert!(err.contains(old.home.to_string_lossy().as_ref()) && err.contains("JDK 25 or newer"), "{err}"); assert!(err.contains(SERVER_JDK_SETTING), "both messages point at the same setting: {err}"); }