unroll test loop

This commit is contained in:
Max Heller 2023-08-05 08:22:58 -04:00
parent 5e6d646ccc
commit d48606fefe

View File

@ -715,8 +715,8 @@ struct Foo {
#[test] #[test]
fn completes_const_and_type_generics_separately() { fn completes_const_and_type_generics_separately() {
let type_completion_cases = [ // Function generic params
// Function check(
r#" r#"
struct Foo; struct Foo;
const X: usize = 0; const X: usize = 0;
@ -725,7 +725,41 @@ fn main() {
foo::<F$0, _>(); foo::<F$0, _>();
} }
"#, "#,
// Method expect![[r#"
en Enum
ma makro!() macro_rules! makro
md module
st Foo
st Record
st Tuple
st Unit
tt Trait
un Union
bt u32
kw crate::
kw self::
"#]],
);
check(
r#"
struct Foo;
const X: usize = 0;
fn foo<T, const N: usize>() {}
fn main() {
foo::<_, $0>();
}
"#,
expect![[r#"
ct CONST
ct X
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
// Method generic params
check(
r#" r#"
const X: usize = 0; const X: usize = 0;
struct Foo; struct Foo;
@ -734,28 +768,40 @@ fn main() {
Foo.bar::<_, $0>(); Foo.bar::<_, $0>();
} }
"#, "#,
]; expect![[r#"
en Enum
for case in type_completion_cases { ma makro!() macro_rules! makro
check( md module
case, st Foo
expect![[r#" st Record
en Enum st Tuple
ma makro!() macro_rules! makro st Unit
md module tt Trait
st Foo un Union
st Record bt u32
st Tuple kw crate::
st Unit kw self::
tt Trait "#]],
un Union );
bt u32 check(
kw crate:: r#"
kw self:: const X: usize = 0;
"#]], struct Foo;
) impl Foo { fn bar<const N: usize, T>(self) {} }
} fn main() {
Foo.bar::<X$0, _>();
}
"#,
expect![[r#"
ct CONST
ct X
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
// Associated type generic params
check( check(
r#" r#"
const X: usize = 0; const X: usize = 0;
@ -781,27 +827,7 @@ fn foo(_: impl Bar<Baz<F$0, 0> = ()>) {}
kw self:: kw self::
"#]], "#]],
); );
check(
let const_completion_cases = [
// Function params
r#"
struct Foo;
const X: usize = 0;
fn foo<T, const N: usize>() {}
fn main() {
foo::<_, $0>();
}
"#,
// Method params
r#"
const X: usize = 0;
struct Foo;
impl Foo { fn bar<const N: usize, T>(self) {} }
fn main() {
Foo.bar::<X$0, _>();
}
"#,
// Associated type params
r#" r#"
const X: usize = 0; const X: usize = 0;
struct Foo; struct Foo;
@ -810,7 +836,17 @@ trait Bar {
} }
fn foo<T: Bar<Baz<(), $0> = ()>>() {} fn foo<T: Bar<Baz<(), $0> = ()>>() {}
"#, "#,
// Type params expect![[r#"
ct CONST
ct X
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
// Type generic params
check(
r#" r#"
const X: usize = 0; const X: usize = 0;
struct Foo<T, const N: usize>(T); struct Foo<T, const N: usize>(T);
@ -818,7 +854,17 @@ fn main() {
let _: Foo::<_, $0> = Foo(()); let _: Foo::<_, $0> = Foo(());
} }
"#, "#,
// Enum variant params expect![[r#"
ct CONST
ct X
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
// Type alias generic params
check(
r#" r#"
const X: usize = 0; const X: usize = 0;
struct Foo<T, const N: usize>(T); struct Foo<T, const N: usize>(T);
@ -827,6 +873,17 @@ fn main() {
let _: Bar::<X$0, _> = Bar(()); let _: Bar::<X$0, _> = Bar(());
} }
"#, "#,
expect![[r#"
ct CONST
ct X
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
// Enum variant params
check(
r#" r#"
const X: usize = 0; const X: usize = 0;
enum Foo<T, const N: usize> { A(T), B } enum Foo<T, const N: usize> { A(T), B }
@ -834,13 +891,33 @@ fn main() {
Foo::B::<(), $0>; Foo::B::<(), $0>;
} }
"#, "#,
// Trait params expect![[r#"
ct CONST
ct X
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
// Trait params
check(
r#" r#"
const X: usize = 0; const X: usize = 0;
trait Foo<T, const N: usize> {} trait Foo<T, const N: usize> {}
impl Foo<(), $0> for () {} impl Foo<(), $0> for () {}
"#, "#,
// Trait alias params expect![[r#"
ct CONST
ct X
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
// Trait alias params
check(
r#" r#"
#![feature(trait_alias)] #![feature(trait_alias)]
const X: usize = 0; const X: usize = 0;
@ -848,18 +925,12 @@ trait Foo<T, const N: usize> {}
trait Bar<const M: usize, U> = Foo<U, M>; trait Bar<const M: usize, U> = Foo<U, M>;
fn foo<T: Bar<X$0, ()>>() {} fn foo<T: Bar<X$0, ()>>() {}
"#, "#,
]; expect![[r#"
ct CONST
for case in const_completion_cases { ct X
check( ma makro!() macro_rules! makro
case, kw crate::
expect![[r#" kw self::
ct CONST "#]],
ct X );
ma makro!() macro_rules! makro
kw crate::
kw self::
"#]],
);
}
} }