Skip to content

Commit 66fd262

Browse files
committed
Fix assist test logic
1 parent 2b4a784 commit 66fd262

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/assists/src/tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ fn check(handler: Handler, before: &str, expected: ExpectedResult, assist_label:
123123
for file_system_edit in source_change.file_system_edits.clone() {
124124
match file_system_edit {
125125
FileSystemEdit::CreateFile { dst, initial_contents } => {
126-
let target_dst = dst.path;
127-
format_to!(buf, "//- {}\n", target_dst);
126+
let sr = db.file_source_root(dst.anchor);
127+
let sr = db.source_root(sr);
128+
let mut base = sr.path_for_file(&dst.anchor).unwrap().clone();
129+
base.pop();
130+
let created_file_path = format!("{}{}", base.to_string(), &dst.path[1..]);
131+
format_to!(buf, "//- {}\n", created_file_path);
128132
buf.push_str(&initial_contents);
129133
}
130134
_ => (),

0 commit comments

Comments
 (0)