windows: Fix tests on Windows (#22616)

Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla.c.maki@gmail.com>
This commit is contained in:
张小白 2025-02-05 22:30:09 +08:00 committed by GitHub
parent c252b5db16
commit 74c4dbd237
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 1540 additions and 856 deletions

View file

@ -1061,6 +1061,7 @@ async fn get_copilot_lsp(http: Arc<dyn HttpClient>) -> anyhow::Result<PathBuf> {
mod tests {
use super::*;
use gpui::TestAppContext;
use util::path;
#[gpui::test(iterations = 10)]
async fn test_buffer_management(cx: &mut TestAppContext) {
@ -1123,7 +1124,7 @@ mod tests {
buffer_1.update(cx, |buffer, cx| {
buffer.file_updated(
Arc::new(File {
abs_path: "/root/child/buffer-1".into(),
abs_path: path!("/root/child/buffer-1").into(),
path: Path::new("child/buffer-1").into(),
}),
cx,
@ -1136,7 +1137,7 @@ mod tests {
text_document: lsp::TextDocumentIdentifier::new(buffer_1_uri),
}
);
let buffer_1_uri = lsp::Url::from_file_path("/root/child/buffer-1").unwrap();
let buffer_1_uri = lsp::Url::from_file_path(path!("/root/child/buffer-1")).unwrap();
assert_eq!(
lsp.receive_notification::<lsp::notification::DidOpenTextDocument>()
.await,

View file

@ -290,7 +290,10 @@ mod tests {
use serde_json::json;
use settings::SettingsStore;
use std::future::Future;
use util::test::{marked_text_ranges_by, TextRangeMarker};
use util::{
path,
test::{marked_text_ranges_by, TextRangeMarker},
};
#[gpui::test(iterations = 10)]
async fn test_copilot(executor: BackgroundExecutor, cx: &mut TestAppContext) {
@ -949,24 +952,24 @@ mod tests {
let fs = FakeFs::new(cx.executor());
fs.insert_tree(
"/test",
path!("/test"),
json!({
".env": "SECRET=something\n",
"README.md": "hello\nworld\nhow\nare\nyou\ntoday"
}),
)
.await;
let project = Project::test(fs, ["/test".as_ref()], cx).await;
let project = Project::test(fs, [path!("/test").as_ref()], cx).await;
let private_buffer = project
.update(cx, |project, cx| {
project.open_local_buffer("/test/.env", cx)
project.open_local_buffer(path!("/test/.env"), cx)
})
.await
.unwrap();
let public_buffer = project
.update(cx, |project, cx| {
project.open_local_buffer("/test/README.md", cx)
project.open_local_buffer(path!("/test/README.md"), cx)
})
.await
.unwrap();