diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 804bcb0153..813ab6a6e4 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -555,27 +555,16 @@ mod tests { use crate::fixture; - use super::{RunnableTestKind::*, *}; - - fn check( - ra_fixture: &str, - // FIXME: fold this into `expect` as well - actions: &[RunnableTestKind], - expect: Expect, - ) { + fn check(ra_fixture: &str, expect: Expect) { let (analysis, position) = fixture::position(ra_fixture); - let mut runnables = analysis.runnables(position.file_id).unwrap(); - runnables.sort_by_key(|it| (it.nav.full_range.start(), it.nav.name.clone())); - - let mut navigation_targets = Vec::with_capacity(runnables.len()); - let mut test_kinds = Vec::with_capacity(runnables.len()); - for runnable in runnables { - test_kinds.push(runnable.test_kind()); - navigation_targets.push(runnable.nav); - } - - expect.assert_debug_eq(&navigation_targets); - assert_eq!(actions, test_kinds.as_slice()); + let mut result = analysis + .runnables(position.file_id) + .unwrap() + .into_iter() + .map(|runnable| (runnable.test_kind(), runnable.nav)) + .collect::>(); + result.sort_by_key(|(_, nav)| (nav.full_range.start(), nav.name.clone())); + expect.assert_debug_eq(&result); } fn check_tests(ra_fixture: &str, expect: Expect) { @@ -613,71 +602,91 @@ mod not_a_root { fn main() {} } "#, - &[TestMod, Bin, Bin, Test, Test, Test, Bench], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 0..253, - name: "", - kind: Module, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 15..76, - focus_range: 42..71, - name: "__cortex_m_rt_main_trampoline", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 78..102, - focus_range: 89..97, - name: "test_foo", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 104..155, - focus_range: 136..150, - name: "test_full_path", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 157..191, - focus_range: 178..186, - name: "test_foo", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 193..215, - focus_range: 205..210, - name: "bench", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 0..253, + name: "", + kind: Module, + }, + ), + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 15..76, + focus_range: 42..71, + name: "__cortex_m_rt_main_trampoline", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 78..102, + focus_range: 89..97, + name: "test_foo", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 104..155, + focus_range: 136..150, + name: "test_full_path", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 157..191, + focus_range: 178..186, + name: "test_foo", + kind: Function, + }, + ), + ( + Bench, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 193..215, + focus_range: 205..210, + name: "bench", + kind: Function, + }, + ), ] "#]], ); @@ -779,78 +788,104 @@ trait Test { /// ``` impl Test for StructWithRunnable {} "#, - &[Bin, DocTest, DocTest, DocTest, DocTest, DocTest, DocTest, DocTest, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 15..74, - name: "should_have_runnable", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 76..148, - name: "should_have_runnable_1", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 150..254, - name: "should_have_runnable_2", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 256..320, - name: "should_have_no_runnable_3", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 322..398, - name: "should_have_no_runnable_4", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 900..965, - name: "StructWithRunnable", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 967..1024, - focus_range: 1003..1021, - name: "impl", - kind: Impl, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1088..1154, - focus_range: 1133..1151, - name: "impl", - kind: Impl, - }, + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 15..74, + name: "should_have_runnable", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 76..148, + name: "should_have_runnable_1", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 150..254, + name: "should_have_runnable_2", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 256..320, + name: "should_have_no_runnable_3", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 322..398, + name: "should_have_no_runnable_4", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 900..965, + name: "StructWithRunnable", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 967..1024, + focus_range: 1003..1021, + name: "impl", + kind: Impl, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1088..1154, + focus_range: 1133..1151, + name: "impl", + kind: Impl, + }, + ), ] "#]], ); @@ -872,25 +907,30 @@ impl Data { fn foo() {} } "#, - &[Bin, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 44..98, - name: "foo", - }, + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 44..98, + name: "foo", + }, + ), ] "#]], ); @@ -912,25 +952,30 @@ impl Data<'a> { fn foo() {} } "#, - &[Bin, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 52..106, - name: "foo", - }, + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 52..106, + name: "foo", + }, + ), ] "#]], ); @@ -952,25 +997,30 @@ impl Data<'a, T, U> { fn foo() {} } "#, - &[Bin, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 70..124, - name: "foo", - }, + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 70..124, + name: "foo", + }, + ), ] "#]], ); @@ -992,25 +1042,30 @@ impl Data { fn foo() {} } "#, - &[Bin, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 79..133, - name: "foo", - }, + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 79..133, + name: "foo", + }, + ), ] "#]], ); @@ -1032,25 +1087,30 @@ impl<'a, T, const N: usize> Data<'a, T, N> { fn foo() {} } "#, - &[Bin, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 100..154, - name: "foo", - }, + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 100..154, + name: "foo", + }, + ), ] "#]], ); @@ -1066,28 +1126,33 @@ mod test_mod { fn test_foo1() {} } "#, - &[TestMod, Test], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..51, - focus_range: 5..13, - name: "test_mod", - kind: Module, - description: "mod test_mod", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 20..49, - focus_range: 35..44, - name: "test_foo1", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..51, + focus_range: 5..13, + name: "test_mod", + kind: Module, + description: "mod test_mod", + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 20..49, + focus_range: 35..44, + name: "test_foo1", + kind: Function, + }, + ), ] "#]], ); @@ -1120,66 +1185,83 @@ mod root_tests { mod nested_tests_4 {} } "#, - &[TestMod, TestMod, Test, Test, TestMod, Test], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 22..323, - focus_range: 26..40, - name: "nested_tests_0", - kind: Module, - description: "mod nested_tests_0", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 51..192, - focus_range: 55..69, - name: "nested_tests_1", - kind: Module, - description: "mod nested_tests_1", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 84..126, - focus_range: 107..121, - name: "nested_test_11", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 140..182, - focus_range: 163..177, - name: "nested_test_12", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 202..286, - focus_range: 206..220, - name: "nested_tests_2", - kind: Module, - description: "mod nested_tests_2", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 235..276, - focus_range: 258..271, - name: "nested_test_2", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 22..323, + focus_range: 26..40, + name: "nested_tests_0", + kind: Module, + description: "mod nested_tests_0", + }, + ), + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 51..192, + focus_range: 55..69, + name: "nested_tests_1", + kind: Module, + description: "mod nested_tests_1", + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 84..126, + focus_range: 107..121, + name: "nested_test_11", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 140..182, + focus_range: 163..177, + name: "nested_test_12", + kind: Function, + }, + ), + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 202..286, + focus_range: 206..220, + name: "nested_tests_2", + kind: Module, + description: "mod nested_tests_2", + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 235..276, + focus_range: 258..271, + name: "nested_test_2", + kind: Function, + }, + ), ] "#]], ); @@ -1195,26 +1277,31 @@ $0 #[cfg(feature = "foo")] fn test_foo1() {} "#, - &[TestMod, Test], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 0..51, - name: "", - kind: Module, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..50, - focus_range: 36..45, - name: "test_foo1", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 0..51, + name: "", + kind: Module, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..50, + focus_range: 36..45, + name: "test_foo1", + kind: Function, + }, + ), ] "#]], ); @@ -1230,26 +1317,31 @@ $0 #[cfg(all(feature = "foo", feature = "bar"))] fn test_foo1() {} "#, - &[TestMod, Test], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 0..73, - name: "", - kind: Module, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..72, - focus_range: 58..67, - name: "test_foo1", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 0..73, + name: "", + kind: Module, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..72, + focus_range: 58..67, + name: "test_foo1", + kind: Function, + }, + ), ] "#]], ); @@ -1265,7 +1357,6 @@ mod test_mod { fn foo1() {} } "#, - &[], expect![[r#" [] "#]], @@ -1287,16 +1378,18 @@ impl Foo { fn foo() {} } "#, - &[DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 1, - ), - full_range: 27..81, - name: "foo", - }, + ( + DocTest, + NavigationTarget { + file_id: FileId( + 1, + ), + full_range: 27..81, + name: "foo", + }, + ), ] "#]], ); @@ -1333,60 +1426,77 @@ mod tests { gen2!(); gen_main!(); "#, - &[TestMod, TestMod, Test, Test, TestMod, Bin], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 0..315, - name: "", - kind: Module, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 267..292, - focus_range: 271..276, - name: "tests", - kind: Module, - description: "mod tests", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 283..290, - name: "foo_test", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 293..301, - name: "foo_test2", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 293..301, - name: "tests2", - kind: Module, - description: "mod tests2", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 302..314, - name: "main", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 0..315, + name: "", + kind: Module, + }, + ), + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 267..292, + focus_range: 271..276, + name: "tests", + kind: Module, + description: "mod tests", + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 283..290, + name: "foo_test", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 293..301, + name: "foo_test2", + kind: Function, + }, + ), + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 293..301, + name: "tests2", + kind: Module, + description: "mod tests2", + }, + ), + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 302..314, + name: "main", + kind: Function, + }, + ), ] "#]], ); @@ -1412,42 +1522,53 @@ macro_rules! foo { } foo!(); "#, - &[Test, Test, Test, TestMod], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 210..217, - name: "foo0", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 210..217, - name: "foo1", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 210..217, - name: "foo2", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 210..217, - name: "foo_tests", - kind: Module, - description: "mod foo_tests", - }, + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 210..217, + name: "foo0", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 210..217, + name: "foo1", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 210..217, + name: "foo2", + kind: Function, + }, + ), + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 210..217, + name: "foo_tests", + kind: Module, + description: "mod foo_tests", + }, + ), ] "#]], ); @@ -1466,7 +1587,6 @@ mod tests { fn t() {} } "#, - &[], expect![[r#" [] "#]], @@ -1486,19 +1606,21 @@ fn t0() {} #[test] fn t1() {} "#, - &[TestMod], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..7, - focus_range: 5..6, - name: "m", - kind: Module, - description: "mod m", - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..7, + focus_range: 5..6, + name: "m", + kind: Module, + description: "mod m", + }, + ), ] "#]], ); @@ -1517,35 +1639,43 @@ fn t0() {} #[test] fn t1() {} "#, - &[TestMod, Test, Test], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 1, - ), - full_range: 0..39, - name: "m", - kind: Module, - }, - NavigationTarget { - file_id: FileId( - 1, - ), - full_range: 1..19, - focus_range: 12..14, - name: "t0", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 1, - ), - full_range: 20..38, - focus_range: 31..33, - name: "t1", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 1, + ), + full_range: 0..39, + name: "m", + kind: Module, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 1, + ), + full_range: 1..19, + focus_range: 12..14, + name: "t0", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 1, + ), + full_range: 20..38, + focus_range: 31..33, + name: "t1", + kind: Function, + }, + ), ] "#]], ); @@ -1566,37 +1696,45 @@ mod module { fn t1() {} } "#, - &[TestMod, Test, Test], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 26..94, - focus_range: 30..36, - name: "module", - kind: Module, - description: "mod module", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 43..65, - focus_range: 58..60, - name: "t0", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 70..92, - focus_range: 85..87, - name: "t1", - kind: Function, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 26..94, + focus_range: 30..36, + name: "module", + kind: Module, + description: "mod module", + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 43..65, + focus_range: 58..60, + name: "t0", + kind: Function, + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 70..92, + focus_range: 85..87, + name: "t1", + kind: Function, + }, + ), ] "#]], ); @@ -1782,25 +1920,30 @@ impl Data<'a, A, 12, C, D> { fn foo() {} } "#, - &[Bin, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..13, - focus_range: 4..8, - name: "main", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 121..156, - name: "foo", - }, + ( + Bin, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..13, + focus_range: 4..8, + name: "main", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 121..156, + name: "foo", + }, + ), ] "#]], ); @@ -1830,41 +1973,52 @@ impl Foo, ()> { fn t() {} } "#, - &[DocTest, DocTest, DocTest, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 20..103, - focus_range: 47..56, - name: "impl", - kind: Impl, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 63..101, - name: "t", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 105..188, - focus_range: 126..146, - name: "impl", - kind: Impl, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 153..186, - name: "t", - }, + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 20..103, + focus_range: 47..56, + name: "impl", + kind: Impl, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 63..101, + name: "t", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 105..188, + focus_range: 126..146, + name: "impl", + kind: Impl, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 153..186, + name: "t", + }, + ), ] "#]], ); @@ -1890,7 +2044,6 @@ macro_rules! foo { }; } "#, - &[], expect![[r#" [] "#]], @@ -1910,16 +2063,18 @@ macro_rules! foo { }; } "#, - &[DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..94, - name: "foo", - }, + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..94, + name: "foo", + }, + ), ] "#]], ); @@ -1965,76 +2120,99 @@ mod r#mod { impl r#trait for r#struct {} } "#, - &[TestMod, Test, DocTest, DocTest, DocTest, DocTest, DocTest, DocTest], expect![[r#" [ - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 1..461, - focus_range: 5..10, - name: "r#mod", - kind: Module, - description: "mod r#mod", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 17..41, - focus_range: 32..36, - name: "r#fn", - kind: Function, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 47..84, - name: "r#for", - container_name: "r#mod", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 90..146, - name: "r#struct", - container_name: "r#mod", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 152..266, - focus_range: 189..205, - name: "impl", - kind: Impl, - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 216..260, - name: "r#fn", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 323..367, - name: "r#fn", - }, - NavigationTarget { - file_id: FileId( - 0, - ), - full_range: 401..459, - focus_range: 445..456, - name: "impl", - kind: Impl, - }, + ( + TestMod, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 1..461, + focus_range: 5..10, + name: "r#mod", + kind: Module, + description: "mod r#mod", + }, + ), + ( + Test, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 17..41, + focus_range: 32..36, + name: "r#fn", + kind: Function, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 47..84, + name: "r#for", + container_name: "r#mod", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 90..146, + name: "r#struct", + container_name: "r#mod", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 152..266, + focus_range: 189..205, + name: "impl", + kind: Impl, + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 216..260, + name: "r#fn", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 323..367, + name: "r#fn", + }, + ), + ( + DocTest, + NavigationTarget { + file_id: FileId( + 0, + ), + full_range: 401..459, + focus_range: 445..456, + name: "impl", + kind: Impl, + }, + ), ] "#]], )