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>
This commit is contained in:
arookieofc
2026-11-01 16:16:14 +08:00
committed by GitHub
co-authored by a-rookie-of-C-language
parent f19eacc336
commit 683f8d8826
+4 -1
View File
@@ -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);