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 <[email protected]>
This commit is contained in:
arookieofcanda-rookie-of-C-language authored and GitHub committed 2026-11-02 20:07:48 +08:00
1 parent 3be40bd57c
commit e3f8932e21
1 file changed
+6 -2
+6 -2
View File
@@ -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}");
}