Fix incorrect base fixture in ide_completion tests

This commit is contained in:
Lukas Wirth 2021-06-23 19:13:24 +02:00
parent 9abd28ac37
commit 85736f2dc9
5 changed files with 67 additions and 49 deletions

View File

@ -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 {

View File

@ -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
"##]],
);
}

View File

@ -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
"#]],
"##]],
)
}

View File

@ -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
"##]],
);
}

View File

@ -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
"#]],
"##]],
);
}