diff options
Diffstat (limited to 'crates/ra_ide_api/tests/test/main.rs')
-rw-r--r-- | crates/ra_ide_api/tests/test/main.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/crates/ra_ide_api/tests/test/main.rs b/crates/ra_ide_api/tests/test/main.rs index 4aa13b0e7..2077a89ce 100644 --- a/crates/ra_ide_api/tests/test/main.rs +++ b/crates/ra_ide_api/tests/test/main.rs | |||
@@ -7,8 +7,6 @@ use ra_syntax::TextRange; | |||
7 | use test_utils::assert_eq_text; | 7 | use test_utils::assert_eq_text; |
8 | use insta::assert_debug_snapshot_matches; | 8 | use insta::assert_debug_snapshot_matches; |
9 | 9 | ||
10 | mod runnables; | ||
11 | |||
12 | #[test] | 10 | #[test] |
13 | fn test_unresolved_module_diagnostic() { | 11 | fn test_unresolved_module_diagnostic() { |
14 | let (analysis, file_id) = single_file("mod foo;"); | 12 | let (analysis, file_id) = single_file("mod foo;"); |
@@ -182,10 +180,22 @@ fn test_rename_mod() { | |||
182 | ); | 180 | ); |
183 | let new_name = "foo2"; | 181 | let new_name = "foo2"; |
184 | let source_change = analysis.rename(position, new_name).unwrap(); | 182 | let source_change = analysis.rename(position, new_name).unwrap(); |
185 | assert_eq_dbg( | 183 | assert_debug_snapshot_matches!("rename_mod", &source_change); |
186 | 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: "bar/foo2.rs" }], cursor_position: None })"#, | 184 | } |
187 | &source_change, | 185 | |
186 | #[test] | ||
187 | fn test_rename_mod_in_dir() { | ||
188 | let (analysis, position) = analysis_and_position( | ||
189 | " | ||
190 | //- /lib.rs | ||
191 | mod fo<|>o; | ||
192 | //- /foo/mod.rs | ||
193 | // emtpy | ||
194 | ", | ||
188 | ); | 195 | ); |
196 | let new_name = "foo2"; | ||
197 | let source_change = analysis.rename(position, new_name).unwrap(); | ||
198 | assert_debug_snapshot_matches!("rename_mod_in_dir", &source_change); | ||
189 | } | 199 | } |
190 | 200 | ||
191 | fn test_rename(text: &str, new_name: &str, expected: &str) { | 201 | fn test_rename(text: &str, new_name: &str, expected: &str) { |