diff --git a/crates/ide_completion/src/tests.rs b/crates/ide_completion/src/tests.rs index 89faa9526c4..d2a502b9f9f 100644 --- a/crates/ide_completion/src/tests.rs +++ b/crates/ide_completion/src/tests.rs @@ -40,8 +40,11 @@ static STATIC: Unit = Unit; const CONST: Unit = Unit; struct Record { field: u32 } struct Tuple(u32); -struct Unit +struct Unit; +#[macro_export] macro_rules! makro {} +#[rustc_builtin_macro] +pub macro Clone {} "#; pub(crate) const TEST_CONFIG: CompletionConfig = CompletionConfig { diff --git a/crates/ide_completion/src/tests/item_list.rs b/crates/ide_completion/src/tests/item_list.rs index ae71adf8e00..77f00e8e5c1 100644 --- a/crates/ide_completion/src/tests/item_list.rs +++ b/crates/ide_completion/src/tests/item_list.rs @@ -11,7 +11,7 @@ fn check(ra_fixture: &str, expect: Expect) { fn in_mod_item_list() { check( r#"mod tests { $0 }"#, - expect![[r#" + expect![[r##" kw pub(crate) kw pub kw unsafe @@ -30,8 +30,8 @@ fn in_mod_item_list() { sn tmod (Test module) sn tfn (Test function) sn macro_rules - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ) } @@ -39,7 +39,7 @@ fn in_mod_item_list() { fn in_source_file_item_list() { check( r#"$0"#, - expect![[r#" + expect![[r##" kw pub(crate) kw pub kw unsafe @@ -58,9 +58,10 @@ fn in_source_file_item_list() { sn tmod (Test module) sn tfn (Test function) sn macro_rules + ma makro!(…) #[macro_export] macro_rules! makro md module - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ) } @@ -95,7 +96,7 @@ fn in_item_list_after_attr() { fn in_qualified_path() { check( r#"crate::$0"#, - expect![[r#" + expect![[r##" kw pub(crate) kw pub kw unsafe @@ -111,8 +112,9 @@ fn in_qualified_path() { kw enum kw struct kw union + ma makro!(…) #[macro_export] macro_rules! makro md module - "#]], + "##]], ) } @@ -165,16 +167,17 @@ fn after_visibility_unsafe() { fn in_impl_assoc_item_list() { check( r#"impl Struct { $0 }"#, - expect![[r#" + expect![[r##" kw pub(crate) kw pub kw unsafe kw fn kw const kw type + ma makro!(…) #[macro_export] macro_rules! makro md module - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ) } @@ -197,13 +200,14 @@ fn in_impl_assoc_item_list_after_attr() { fn in_trait_assoc_item_list() { check( r"trait Foo { $0 }", - expect![[r#" + expect![[r##" kw unsafe kw fn kw const kw type md module - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ); } diff --git a/crates/ide_completion/src/tests/items.rs b/crates/ide_completion/src/tests/items.rs index 5acfdcc85da..ef2015107e3 100644 --- a/crates/ide_completion/src/tests/items.rs +++ b/crates/ide_completion/src/tests/items.rs @@ -17,16 +17,17 @@ fn target_type_or_trait_in_impl_block() { r#" impl Tra$0 "#, - expect![[r#" + expect![[r##" tt Trait en Enum st Record st Tuple + ma makro!(…) #[macro_export] macro_rules! makro md module st Unit - ma makro!(…) macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro bt u32 - "#]], + "##]], ) } @@ -36,16 +37,17 @@ fn target_type_in_trait_impl_block() { r#" impl Trait for Str$0 "#, - expect![[r#" + expect![[r##" tt Trait en Enum st Record st Tuple + ma makro!(…) #[macro_export] macro_rules! makro md module st Unit - ma makro!(…) macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro bt u32 - "#]], + "##]], ) } diff --git a/crates/ide_completion/src/tests/pattern.rs b/crates/ide_completion/src/tests/pattern.rs index 48c2fa9aa28..9d70aca3c95 100644 --- a/crates/ide_completion/src/tests/pattern.rs +++ b/crates/ide_completion/src/tests/pattern.rs @@ -109,7 +109,7 @@ fn foo() { if let a$0 } "#, - expect![[r#" + expect![[r##" kw mut en Enum bn Record Record { field$1 }$0 @@ -117,12 +117,13 @@ fn foo() { bn Tuple Tuple($1)$0 st Tuple md module + st Unit + ma makro!(…) #[macro_export] macro_rules! makro bn TupleV TupleV($1)$0 ev TupleV - st Unit ct CONST - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ); } @@ -134,15 +135,16 @@ fn foo() { let a$0 } "#, - expect![[r#" + expect![[r##" kw mut bn Record Record { field$1 }$0 st Record bn Tuple Tuple($1)$0 st Tuple st Unit - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ); } @@ -153,15 +155,16 @@ fn in_param() { fn foo(a$0) { } "#, - expect![[r#" + expect![[r##" kw mut bn Record Record { field$1 }: Record$0 st Record bn Tuple Tuple($1): Tuple$0 st Tuple st Unit - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ); } diff --git a/crates/ide_completion/src/tests/predicate.rs b/crates/ide_completion/src/tests/predicate.rs index 2130c538f2f..2b8ba86b238 100644 --- a/crates/ide_completion/src/tests/predicate.rs +++ b/crates/ide_completion/src/tests/predicate.rs @@ -15,7 +15,7 @@ fn predicate_start() { r#" struct Foo<'lt, T, const C: usize> where $0 {} "#, - expect![[r#" + expect![[r##" tt Trait en Enum st Record @@ -23,9 +23,10 @@ struct Foo<'lt, T, const C: usize> where $0 {} md module st Foo<…> st Unit - ma makro!(…) macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro bt u32 - "#]], + "##]], ); } @@ -36,11 +37,12 @@ fn bound_for_type_pred() { r#" struct Foo<'lt, T, const C: usize> where T: $0 {} "#, - expect![[r#" + expect![[r##" tt Trait md module - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ); } @@ -51,11 +53,12 @@ fn bound_for_lifetime_pred() { r#" struct Foo<'lt, T, const C: usize> where 'lt: $0 {} "#, - expect![[r#" + expect![[r##" tt Trait md module - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ); } @@ -65,11 +68,12 @@ fn bound_for_for_pred() { r#" struct Foo<'lt, T, const C: usize> where for<'a> T: $0 {} "#, - expect![[r#" + expect![[r##" tt Trait md module - ma makro!(…) macro_rules! makro - "#]], + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + "##]], ); } @@ -79,7 +83,7 @@ fn param_list_for_for_pred() { r#" struct Foo<'lt, T, const C: usize> where for<'a> $0 {} "#, - expect![[r#" + expect![[r##" tt Trait en Enum st Record @@ -87,9 +91,10 @@ struct Foo<'lt, T, const C: usize> where for<'a> $0 {} md module st Foo<…> st Unit - ma makro!(…) macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro bt u32 - "#]], + "##]], ); } @@ -101,16 +106,17 @@ impl Record { fn method(self) where $0 {} } "#, - expect![[r#" + expect![[r##" sp Self tt Trait en Enum st Record st Tuple + ma makro!(…) #[macro_export] macro_rules! makro md module st Unit - ma makro!(…) macro_rules! makro + ma makro!(…) #[macro_export] macro_rules! makro bt u32 - "#]], + "##]], ); }