diff options
author | Aleksey Kladov <[email protected]> | 2020-06-24 10:29:43 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-24 10:29:43 +0100 |
commit | c6795fb83a850dde6ac0b08decf108c0c3aa452a (patch) | |
tree | 6f5ae66dc754b6e20069bdcbccf70fa42b236b57 /crates/ra_ide/src/references | |
parent | e9cb818c2683e06153f013c3b8d03f7f2719eb02 (diff) |
More consistent usage of fixtures
Diffstat (limited to 'crates/ra_ide/src/references')
-rw-r--r-- | crates/ra_ide/src/references/rename.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 6edf565b5..91545e025 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -276,6 +276,7 @@ mod tests { | |||
276 | use crate::{ | 276 | use crate::{ |
277 | mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId, | 277 | mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId, |
278 | }; | 278 | }; |
279 | use stdx::trim_indent; | ||
279 | 280 | ||
280 | #[test] | 281 | #[test] |
281 | fn test_rename_to_underscore() { | 282 | fn test_rename_to_underscore() { |
@@ -1053,8 +1054,9 @@ pub mod foo<|>; | |||
1053 | ); | 1054 | ); |
1054 | } | 1055 | } |
1055 | 1056 | ||
1056 | fn test_rename(text: &str, new_name: &str, expected: &str) { | 1057 | fn test_rename(ra_fixture_before: &str, new_name: &str, ra_fixture_after: &str) { |
1057 | let (analysis, position) = single_file_with_position(text); | 1058 | let ra_fixture_after = &trim_indent(ra_fixture_after); |
1059 | let (analysis, position) = single_file_with_position(ra_fixture_before); | ||
1058 | let source_change = analysis.rename(position, new_name).unwrap(); | 1060 | let source_change = analysis.rename(position, new_name).unwrap(); |
1059 | let mut text_edit_builder = TextEditBuilder::default(); | 1061 | let mut text_edit_builder = TextEditBuilder::default(); |
1060 | let mut file_id: Option<FileId> = None; | 1062 | let mut file_id: Option<FileId> = None; |
@@ -1068,6 +1070,6 @@ pub mod foo<|>; | |||
1068 | } | 1070 | } |
1069 | let mut result = analysis.file_text(file_id.unwrap()).unwrap().to_string(); | 1071 | let mut result = analysis.file_text(file_id.unwrap()).unwrap().to_string(); |
1070 | text_edit_builder.finish().apply(&mut result); | 1072 | text_edit_builder.finish().apply(&mut result); |
1071 | assert_eq_text!(expected, &*result); | 1073 | assert_eq_text!(ra_fixture_after, &*result); |
1072 | } | 1074 | } |
1073 | } | 1075 | } |