aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r--crates/ide/src/diagnostics.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index 906f72a42..f5d627b6e 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -218,10 +218,7 @@ mod tests {
218 use stdx::trim_indent; 218 use stdx::trim_indent;
219 use test_utils::assert_eq_text; 219 use test_utils::assert_eq_text;
220 220
221 use crate::{ 221 use crate::{fixture, DiagnosticsConfig};
222 mock_analysis::{analysis_and_position, many_files, single_file},
223 DiagnosticsConfig,
224 };
225 222
226 /// Takes a multi-file input fixture with annotated cursor positions, 223 /// Takes a multi-file input fixture with annotated cursor positions,
227 /// and checks that: 224 /// and checks that:
@@ -231,7 +228,7 @@ mod tests {
231 fn check_fix(ra_fixture_before: &str, ra_fixture_after: &str) { 228 fn check_fix(ra_fixture_before: &str, ra_fixture_after: &str) {
232 let after = trim_indent(ra_fixture_after); 229 let after = trim_indent(ra_fixture_after);
233 230
234 let (analysis, file_position) = analysis_and_position(ra_fixture_before); 231 let (analysis, file_position) = fixture::position(ra_fixture_before);
235 let diagnostic = analysis 232 let diagnostic = analysis
236 .diagnostics(&DiagnosticsConfig::default(), file_position.file_id) 233 .diagnostics(&DiagnosticsConfig::default(), file_position.file_id)
237 .unwrap() 234 .unwrap()
@@ -260,7 +257,7 @@ mod tests {
260 /// which has a fix that can apply to other files. 257 /// which has a fix that can apply to other files.
261 fn check_apply_diagnostic_fix_in_other_file(ra_fixture_before: &str, ra_fixture_after: &str) { 258 fn check_apply_diagnostic_fix_in_other_file(ra_fixture_before: &str, ra_fixture_after: &str) {
262 let ra_fixture_after = &trim_indent(ra_fixture_after); 259 let ra_fixture_after = &trim_indent(ra_fixture_after);
263 let (analysis, file_pos) = analysis_and_position(ra_fixture_before); 260 let (analysis, file_pos) = fixture::position(ra_fixture_before);
264 let current_file_id = file_pos.file_id; 261 let current_file_id = file_pos.file_id;
265 let diagnostic = analysis 262 let diagnostic = analysis
266 .diagnostics(&DiagnosticsConfig::default(), current_file_id) 263 .diagnostics(&DiagnosticsConfig::default(), current_file_id)
@@ -282,7 +279,7 @@ mod tests {
282 /// Takes a multi-file input fixture with annotated cursor position and checks that no diagnostics 279 /// Takes a multi-file input fixture with annotated cursor position and checks that no diagnostics
283 /// apply to the file containing the cursor. 280 /// apply to the file containing the cursor.
284 fn check_no_diagnostics(ra_fixture: &str) { 281 fn check_no_diagnostics(ra_fixture: &str) {
285 let (analysis, files) = many_files(ra_fixture); 282 let (analysis, files) = fixture::files(ra_fixture);
286 let diagnostics = files 283 let diagnostics = files
287 .into_iter() 284 .into_iter()
288 .flat_map(|file_id| { 285 .flat_map(|file_id| {
@@ -293,7 +290,7 @@ mod tests {
293 } 290 }
294 291
295 fn check_expect(ra_fixture: &str, expect: Expect) { 292 fn check_expect(ra_fixture: &str, expect: Expect) {
296 let (analysis, file_id) = single_file(ra_fixture); 293 let (analysis, file_id) = fixture::file(ra_fixture);
297 let diagnostics = analysis.diagnostics(&DiagnosticsConfig::default(), file_id).unwrap(); 294 let diagnostics = analysis.diagnostics(&DiagnosticsConfig::default(), file_id).unwrap();
298 expect.assert_debug_eq(&diagnostics) 295 expect.assert_debug_eq(&diagnostics)
299 } 296 }
@@ -785,7 +782,7 @@ struct Foo {
785 let mut config = DiagnosticsConfig::default(); 782 let mut config = DiagnosticsConfig::default();
786 config.disabled.insert("unresolved-module".into()); 783 config.disabled.insert("unresolved-module".into());
787 784
788 let (analysis, file_id) = single_file(r#"mod foo;"#); 785 let (analysis, file_id) = fixture::file(r#"mod foo;"#);
789 786
790 let diagnostics = analysis.diagnostics(&config, file_id).unwrap(); 787 let diagnostics = analysis.diagnostics(&config, file_id).unwrap();
791 assert!(diagnostics.is_empty()); 788 assert!(diagnostics.is_empty());