diff options
| author | Daiki Ihara <sasurau4@gmail.com> | 2020-12-21 15:50:59 +0900 |
|---|---|---|
| committer | Daiki Ihara <sasurau4@gmail.com> | 2020-12-21 15:55:40 +0900 |
| commit | 66fd262962624db0a72f0aafff49a7c74601beb8 (patch) | |
| tree | 7e481dbc5a6e374ef86bb83d5901d8457c080f2e | |
| parent | 2b4a7848a89e788142a9b74f43a023a2e5c777b9 (diff) | |
| download | rust-66fd262962624db0a72f0aafff49a7c74601beb8.tar.gz rust-66fd262962624db0a72f0aafff49a7c74601beb8.zip | |
Fix assist test logic
| -rw-r--r-- | crates/assists/src/tests.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/assists/src/tests.rs b/crates/assists/src/tests.rs index d18e566e616..b41f4874a5d 100644 --- a/crates/assists/src/tests.rs +++ b/crates/assists/src/tests.rs @@ -123,8 +123,12 @@ fn check(handler: Handler, before: &str, expected: ExpectedResult, assist_label: for file_system_edit in source_change.file_system_edits.clone() { match file_system_edit { FileSystemEdit::CreateFile { dst, initial_contents } => { - let target_dst = dst.path; - format_to!(buf, "//- {}\n", target_dst); + let sr = db.file_source_root(dst.anchor); + let sr = db.source_root(sr); + let mut base = sr.path_for_file(&dst.anchor).unwrap().clone(); + base.pop(); + let created_file_path = format!("{}{}", base.to_string(), &dst.path[1..]); + format_to!(buf, "//- {}\n", created_file_path); buf.push_str(&initial_contents); } _ => (), |
