From 09348b247465864c6462a39055803bcbb0156cfe Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 2 Oct 2020 16:13:48 +0200 Subject: Get rid of MockAnalysis --- crates/ide/src/goto_definition.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'crates/ide/src/goto_definition.rs') diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 15e9b7fad..5fd2d1e9a 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -103,12 +103,11 @@ mod tests { use base_db::FileRange; use syntax::{TextRange, TextSize}; - use crate::mock_analysis::MockAnalysis; + use crate::mock_analysis::analysis_and_annotations; fn check(ra_fixture: &str) { - let (mock, position) = MockAnalysis::with_files_and_position(ra_fixture); - let (mut expected, data) = mock.annotation(); - let analysis = mock.analysis(); + let (analysis, position, mut annotations) = analysis_and_annotations(ra_fixture); + let (mut expected, data) = annotations.pop().unwrap(); match data.as_str() { "" => (), "file" => { @@ -133,9 +132,9 @@ mod tests { fn goto_def_for_extern_crate() { check( r#" - //- /main.rs + //- /main.rs crate:main deps:std extern crate std<|>; - //- /std/lib.rs + //- /std/lib.rs crate:std // empty //^ file "#, @@ -146,9 +145,9 @@ mod tests { fn goto_def_for_renamed_extern_crate() { check( r#" - //- /main.rs + //- /main.rs crate:main deps:std extern crate std as abc<|>; - //- /std/lib.rs + //- /std/lib.rs crate:std // empty //^ file "#, @@ -342,10 +341,10 @@ fn bar() { fn goto_def_for_use_alias() { check( r#" -//- /lib.rs +//- /lib.rs crate:main deps:foo use foo as bar<|>; -//- /foo/lib.rs +//- /foo/lib.rs crate:foo // empty //^ file "#, @@ -356,10 +355,10 @@ use foo as bar<|>; fn goto_def_for_use_alias_foo_macro() { check( r#" -//- /lib.rs +//- /lib.rs crate:main deps:foo use foo::foo as bar<|>; -//- /foo/lib.rs +//- /foo/lib.rs crate:foo #[macro_export] macro_rules! foo { () => { () } } //^^^ @@ -371,7 +370,6 @@ macro_rules! foo { () => { () } } fn goto_def_for_methods() { check( r#" -//- /lib.rs struct Foo; impl Foo { fn frobnicate(&self) { } -- cgit v1.2.3 From b06259673f9b535a63c0cabf4eeb935ff73d86d0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 2 Oct 2020 17:34:31 +0200 Subject: rename mock_analysis -> fixture --- crates/ide/src/goto_definition.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ide/src/goto_definition.rs') diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 5fd2d1e9a..582bf4837 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -103,10 +103,10 @@ mod tests { use base_db::FileRange; use syntax::{TextRange, TextSize}; - use crate::mock_analysis::analysis_and_annotations; + use crate::fixture; fn check(ra_fixture: &str) { - let (analysis, position, mut annotations) = analysis_and_annotations(ra_fixture); + let (analysis, position, mut annotations) = fixture::annotations(ra_fixture); let (mut expected, data) = annotations.pop().unwrap(); match data.as_str() { "" => (), -- cgit v1.2.3