mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Merge #1601
1601: Inline snapshots for tests r=matklad a=theotherphil Fixes https://github.com/rust-analyzer/rust-analyzer/issues/1127. The "cargo format" commits are required to get the formatting tests to pass. However, they actually mess up the formatting. Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
This commit is contained in:
commit
359b3376b3
38 changed files with 870 additions and 1064 deletions
|
@ -341,7 +341,39 @@ mod tests {
|
|||
);
|
||||
let new_name = "foo2";
|
||||
let source_change = analysis.rename(position, new_name).unwrap();
|
||||
assert_debug_snapshot_matches!("rename_mod", &source_change);
|
||||
assert_debug_snapshot_matches!(&source_change,
|
||||
@r#"Some(
|
||||
SourceChange {
|
||||
label: "rename",
|
||||
source_file_edits: [
|
||||
SourceFileEdit {
|
||||
file_id: FileId(
|
||||
2,
|
||||
),
|
||||
edit: TextEdit {
|
||||
atoms: [
|
||||
AtomTextEdit {
|
||||
delete: [4; 7),
|
||||
insert: "foo2",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
file_system_edits: [
|
||||
MoveFile {
|
||||
src: FileId(
|
||||
3,
|
||||
),
|
||||
dst_source_root: SourceRootId(
|
||||
0,
|
||||
),
|
||||
dst_path: "bar/foo2.rs",
|
||||
},
|
||||
],
|
||||
cursor_position: None,
|
||||
},
|
||||
)"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -356,7 +388,40 @@ mod tests {
|
|||
);
|
||||
let new_name = "foo2";
|
||||
let source_change = analysis.rename(position, new_name).unwrap();
|
||||
assert_debug_snapshot_matches!("rename_mod_in_dir", &source_change);
|
||||
assert_debug_snapshot_matches!(&source_change,
|
||||
@r###"Some(
|
||||
SourceChange {
|
||||
label: "rename",
|
||||
source_file_edits: [
|
||||
SourceFileEdit {
|
||||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
edit: TextEdit {
|
||||
atoms: [
|
||||
AtomTextEdit {
|
||||
delete: [4; 7),
|
||||
insert: "foo2",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
file_system_edits: [
|
||||
MoveFile {
|
||||
src: FileId(
|
||||
2,
|
||||
),
|
||||
dst_source_root: SourceRootId(
|
||||
0,
|
||||
),
|
||||
dst_path: "foo2/mod.rs",
|
||||
},
|
||||
],
|
||||
cursor_position: None,
|
||||
},
|
||||
)"###
|
||||
);
|
||||
}
|
||||
|
||||
fn test_rename(text: &str, new_name: &str, expected: &str) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue