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

@ -5,6 +5,7 @@ use menu::SelectPrev;
use project::{Project, ProjectPath};
use serde_json::json;
use std::path::Path;
use util::path;
use workspace::{AppState, Workspace};
#[ctor::ctor]
@ -24,7 +25,7 @@ async fn test_open_with_prev_tab_selected_and_cycle_on_toggle_action(
.fs
.as_fake()
.insert_tree(
"/root",
path!("/root"),
json!({
"1.txt": "First file",
"2.txt": "Second file",
@ -34,7 +35,7 @@ async fn test_open_with_prev_tab_selected_and_cycle_on_toggle_action(
)
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let project = Project::test(app_state.fs.clone(), [path!("/root").as_ref()], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
@ -81,7 +82,7 @@ async fn test_open_with_last_tab_selected(cx: &mut gpui::TestAppContext) {
.fs
.as_fake()
.insert_tree(
"/root",
path!("/root"),
json!({
"1.txt": "First file",
"2.txt": "Second file",
@ -90,7 +91,7 @@ async fn test_open_with_last_tab_selected(cx: &mut gpui::TestAppContext) {
)
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let project = Project::test(app_state.fs.clone(), [path!("/root").as_ref()], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
@ -172,10 +173,10 @@ async fn test_open_with_single_item(cx: &mut gpui::TestAppContext) {
app_state
.fs
.as_fake()
.insert_tree("/root", json!({"1.txt": "Single file"}))
.insert_tree(path!("/root"), json!({"1.txt": "Single file"}))
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let project = Project::test(app_state.fs.clone(), [path!("/root").as_ref()], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
@ -195,7 +196,7 @@ async fn test_close_selected_item(cx: &mut gpui::TestAppContext) {
.fs
.as_fake()
.insert_tree(
"/root",
path!("/root"),
json!({
"1.txt": "First file",
"2.txt": "Second file",
@ -203,7 +204,7 @@ async fn test_close_selected_item(cx: &mut gpui::TestAppContext) {
)
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let project = Project::test(app_state.fs.clone(), [path!("/root").as_ref()], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
@ -241,7 +242,7 @@ async fn test_close_preserves_selected_position(cx: &mut gpui::TestAppContext) {
.fs
.as_fake()
.insert_tree(
"/root",
path!("/root"),
json!({
"1.txt": "First file",
"2.txt": "Second file",
@ -250,7 +251,7 @@ async fn test_close_preserves_selected_position(cx: &mut gpui::TestAppContext) {
)
.await;
let project = Project::test(app_state.fs.clone(), ["/root".as_ref()], cx).await;
let project = Project::test(app_state.fs.clone(), [path!("/root").as_ref()], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));