From 683f8d8826afc1e2df6bf9d7c1deeba1a299f0b1 Mon Sep 17 00:00:00 2001 From: arookieofc <2128194521@qq.com> Date: Sun, 1 Nov 2026 16:16:14 +0800 Subject: [PATCH] test(jdtls): compare resolved source paths as paths, not strings (#665) java_class_file joins the package path with std::path, so on Windows the result uses backslashes while the test's expectation kept the literal forward slash from "p/Outer.java". Compare as Path so separator style does not matter. Co-authored-by: a-rookie-of-C-language <186315048+a-rookie-of-C-language@users.noreply.github.com> --- crates/ide-lsp/tests/mock_server.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ide-lsp/tests/mock_server.rs b/crates/ide-lsp/tests/mock_server.rs index 2cd2b4f9..aa15d3ed 100644 --- a/crates/ide-lsp/tests/mock_server.rs +++ b/crates/ide-lsp/tests/mock_server.rs @@ -1659,7 +1659,10 @@ async fn class_file_opening_routes_sources_and_binary_documents() { s.respond("workspace/executeCommand", json!({"org.eclipse.jdt.ls.core.sourcePaths":[sources]})); for class in ["Outer", "Outer$Nested", "Outer$1"] { let path = h.root.join(format!("target/classes/p/{class}.class")); - assert_eq!(h.mgr.java_class_file(&path, None).await.unwrap(), source.to_string_lossy()); + let resolved = h.mgr.java_class_file(&path, None).await.unwrap(); + // Compare as paths: the manager joins the relative source path with std::path, so + // separators can differ from the literal "p/Outer.java" used to build `source` on Windows. + assert_eq!(Path::new(&resolved), source.as_path()); } let path = h.root.join("build/classes/java/main/p/Missing.class"); let uri = uri_of(&path);