From 92cbdd0cb828f7a8f1ca046415ad1bf67215bf3d Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 31 Oct 2026 11:29:26 +0800 Subject: [PATCH] test(host): open the file for writing before setting its time (#525) Setting a file's modified time needs a writable handle on Windows, so the JVM icon cache check in the RPC test failed there. --- crates/ide-host/tests/rpc.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ide-host/tests/rpc.rs b/crates/ide-host/tests/rpc.rs index 8a5947aa..2455476f 100644 --- a/crates/ide-host/tests/rpc.rs +++ b/crates/ide-host/tests/rpc.rs @@ -91,7 +91,12 @@ async fn serves_projects_files_documents_search_and_runs() { assert_eq!(icons[1]["presentation"]["kind"], "object"); // Replacing a file invalidates its cached metadata, including same-size writes. std::fs::write(&java, "interface Foo {} ").unwrap(); - std::fs::File::open(&java).unwrap().set_modified(std::time::SystemTime::UNIX_EPOCH).unwrap(); + std::fs::OpenOptions::new() + .write(true) + .open(&java) + .unwrap() + .set_modified(std::time::SystemTime::UNIX_EPOCH) + .unwrap(); let icons = invoke(&peer, "jvm_file_presentations", json!({ "paths": [java] })).await.unwrap(); assert_eq!(icons[0]["presentation"]["kind"], "interface"); let oversized = invoke(&peer, "jvm_file_presentations", json!({ "paths": vec![java.clone(); 65] })).await;