aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_assists/src/tests.rs')
-rw-r--r--crates/ide_assists/src/tests.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ide_assists/src/tests.rs b/crates/ide_assists/src/tests.rs
index a7a923beb..6f4f97361 100644
--- a/crates/ide_assists/src/tests.rs
+++ b/crates/ide_assists/src/tests.rs
@@ -4,10 +4,7 @@ use expect_test::expect;
4use hir::Semantics; 4use hir::Semantics;
5use ide_db::{ 5use ide_db::{
6 base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}, 6 base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt},
7 helpers::{ 7 helpers::{insert_use::InsertUseConfig, merge_imports::MergeBehavior, SnippetCap},
8 insert_use::{InsertUseConfig, MergeBehavior},
9 SnippetCap,
10 },
11 source_change::FileSystemEdit, 8 source_change::FileSystemEdit,
12 RootDatabase, 9 RootDatabase,
13}; 10};
@@ -84,7 +81,8 @@ fn check_doc_test(assist_id: &str, before: &str, after: &str) {
84 }); 81 });
85 82
86 let actual = { 83 let actual = {
87 let source_change = assist.source_change.unwrap(); 84 let source_change =
85 assist.source_change.expect("Assist did not contain any source changes");
88 let mut actual = before; 86 let mut actual = before;
89 if let Some(source_file_edit) = source_change.get_source_edit(file_id) { 87 if let Some(source_file_edit) = source_change.get_source_edit(file_id) {
90 source_file_edit.apply(&mut actual); 88 source_file_edit.apply(&mut actual);
@@ -121,7 +119,8 @@ fn check(handler: Handler, before: &str, expected: ExpectedResult, assist_label:
121 119
122 match (assist, expected) { 120 match (assist, expected) {
123 (Some(assist), ExpectedResult::After(after)) => { 121 (Some(assist), ExpectedResult::After(after)) => {
124 let source_change = assist.source_change.unwrap(); 122 let source_change =
123 assist.source_change.expect("Assist did not contain any source changes");
125 assert!(!source_change.source_file_edits.is_empty()); 124 assert!(!source_change.source_file_edits.is_empty());
126 let skip_header = source_change.source_file_edits.len() == 1 125 let skip_header = source_change.source_file_edits.len() == 1
127 && source_change.file_system_edits.len() == 0; 126 && source_change.file_system_edits.len() == 0;
@@ -191,6 +190,7 @@ fn assist_order_field_struct() {
191 let mut assists = assists.iter(); 190 let mut assists = assists.iter();
192 191
193 assert_eq!(assists.next().expect("expected assist").label, "Change visibility to pub(crate)"); 192 assert_eq!(assists.next().expect("expected assist").label, "Change visibility to pub(crate)");
193 assert_eq!(assists.next().expect("expected assist").label, "Generate `Deref` impl using `bar`");
194 assert_eq!(assists.next().expect("expected assist").label, "Generate a mut getter method"); 194 assert_eq!(assists.next().expect("expected assist").label, "Generate a mut getter method");
195 assert_eq!(assists.next().expect("expected assist").label, "Generate a getter method"); 195 assert_eq!(assists.next().expect("expected assist").label, "Generate a getter method");
196 assert_eq!(assists.next().expect("expected assist").label, "Generate a setter method"); 196 assert_eq!(assists.next().expect("expected assist").label, "Generate a setter method");