Canonicalize paths when running tests (#23655)

In the Windows test environment, the paths generated by `temp_tree()`
are symlink paths, which causes certain tests to fail.

I later noticed that when opening a project, we seem to always use
`canonicalize` to normalize the paths, as shown here:
https://github.com/zed-industries/zed/pull/21039.

This PR adopts a similar approach for the test environment to address
the issue.

Release Notes:

- N/A
This commit is contained in:
张小白 2025-01-26 14:56:07 +08:00 committed by GitHub
parent 0f8e2e3811
commit 5d005a7621
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 27 deletions

View file

@ -27,7 +27,7 @@ use unindent::Unindent as _;
use util::{
assert_set_eq,
paths::{replace_path_separator, PathMatcher},
test::temp_tree,
test::TempTree,
TryFutureExt as _,
};
@ -67,7 +67,7 @@ async fn test_symlinks(cx: &mut gpui::TestAppContext) {
init_test(cx);
cx.executor().allow_parking();
let dir = temp_tree(json!({
let dir = TempTree::new(json!({
"root": {
"apple": "",
"banana": {
@ -106,7 +106,7 @@ async fn test_symlinks(cx: &mut gpui::TestAppContext) {
async fn test_editorconfig_support(cx: &mut gpui::TestAppContext) {
init_test(cx);
let dir = temp_tree(json!({
let dir = TempTree::new(json!({
".editorconfig": r#"
root = true
[*.rs]
@ -3187,7 +3187,7 @@ async fn test_rescan_and_remote_updates(cx: &mut gpui::TestAppContext) {
init_test(cx);
cx.executor().allow_parking();
let dir = temp_tree(json!({
let dir = TempTree::new(json!({
"a": {
"file1": "",
"file2": "",