From b9d85f55b7a0a2159971b42bb5dae71efbfeada4 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 21 Jun 2021 14:59:49 +0200 Subject: Move out completion type position tests --- .../src/completions/qualified_path.rs | 76 ----------------- .../src/completions/unqualified_path.rs | 97 ---------------------- 2 files changed, 173 deletions(-) (limited to 'crates/ide_completion/src/completions') diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs index f5dbd203b..1b8997ecf 100644 --- a/crates/ide_completion/src/completions/qualified_path.rs +++ b/crates/ide_completion/src/completions/qualified_path.rs @@ -218,36 +218,6 @@ mod tests { expect.assert_eq(&actual); } - #[test] - fn dont_complete_values_in_type_pos() { - check( - r#" -const FOO: () = (); -static BAR: () = (); -struct Baz; -fn foo() { - let _: self::$0; -} -"#, - expect![[r#" - st Baz - "#]], - ); - } - - #[test] - fn dont_complete_enum_variants_in_type_pos() { - check( - r#" -enum Foo { Bar } -fn foo() { - let _: Foo::$0; -} -"#, - expect![[r#""#]], - ); - } - #[test] fn dont_complete_primitive_in_use() { check_builtin(r#"use self::$0;"#, expect![[""]]); @@ -258,32 +228,6 @@ fn foo() { check_builtin(r#"fn foo() { self::$0 }"#, expect![[""]]); } - #[test] - fn completes_primitives() { - check_builtin( - r#"fn main() { let _: $0 = 92; }"#, - expect![[r#" - bt u32 - bt bool - bt u8 - bt isize - bt u16 - bt u64 - bt u128 - bt f32 - bt i128 - bt i16 - bt str - bt i64 - bt char - bt f64 - bt i32 - bt i8 - bt usize - "#]], - ); - } - #[test] fn completes_enum_variant() { check( @@ -749,24 +693,4 @@ fn main() { "#]], ); } - - #[test] - fn completes_types_and_const_in_arg_list() { - check( - r#" -mod foo { - pub const CONST: () = (); - pub type Type = (); -} - -struct Foo(t); - -fn foo(_: Foo) {} -"#, - expect![[r#" - ta Type - ct CONST - "#]], - ); - } } diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 819fa3a43..380c1e079 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs @@ -112,28 +112,6 @@ mod tests { expect.assert_eq(&actual) } - #[test] - fn dont_complete_values_in_type_pos() { - check( - r#" -const FOO: () = (); -static BAR: () = (); -enum Foo { - Bar -} -struct Baz; -fn foo() { - let local = (); - let _: $0; -} -"#, - expect![[r#" - en Foo - st Baz - "#]], - ); - } - #[test] fn completes_bindings_from_let() { check( @@ -238,29 +216,6 @@ fn main() { ); } - #[test] - fn completes_generic_params_in_struct() { - check( - r#"struct S { x: $0}"#, - expect![[r#" - sp Self - tp T - st S<…> - "#]], - ); - } - - #[test] - fn completes_self_in_enum() { - check( - r#"enum X { Y($0) }"#, - expect![[r#" - sp Self - en X - "#]], - ); - } - #[test] fn completes_module_items() { check( @@ -314,19 +269,6 @@ mod m { ); } - #[test] - fn completes_return_type() { - check( - r#" -struct Foo; -fn x() -> $0 -"#, - expect![[r#" - st Foo - "#]], - ); - } - #[test] fn dont_show_both_completions_for_shadowing() { check( @@ -508,19 +450,6 @@ fn foo() { $0 } ); } - #[test] - fn completes_macros_as_type() { - check( - r#" -macro_rules! foo { () => {} } -fn main() { let x: $0 } -"#, - expect![[r#" - ma foo!(…) macro_rules! foo - "#]], - ); - } - #[test] fn completes_macros_as_stmt() { check( @@ -666,30 +595,4 @@ fn f() {} expect![[""]], ) } - - #[test] - fn completes_types_and_const_in_arg_list() { - check( - r#" -enum Bar { - Baz -} -trait Foo { - type Bar; -} - -const CONST: () = (); - -fn foo, const CONST_PARAM: usize>(_: T) {} -"#, - expect![[r#" - ta Bar = type Bar; - tp T - cp CONST_PARAM - tt Foo - en Bar - ct CONST - "#]], - ); - } } -- cgit v1.2.3