From 58136b01ba0cc0c2f598c300db3cc864fcb09f1f Mon Sep 17 00:00:00 2001 From: Duong Quoc Khanh Date: Thu, 9 Feb 2023 17:32:55 +0900 Subject: [PATCH] Add more tests for completion without body. Add tests for Fn, Const, TypeAlias without body inside Trait. --- crates/ide-completion/src/tests/item_list.rs | 51 ++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/crates/ide-completion/src/tests/item_list.rs b/crates/ide-completion/src/tests/item_list.rs index b62b988885d..9fc731bb11d 100644 --- a/crates/ide-completion/src/tests/item_list.rs +++ b/crates/ide-completion/src/tests/item_list.rs @@ -214,6 +214,57 @@ fn in_trait_assoc_item_list() { ); } +#[test] +fn in_trait_assoc_fn_missing_body() { + check( + r#"trait Foo { fn function(); $0 }"#, + expect![[r#" + ma makro!(…) macro_rules! makro + md module + kw const + kw crate:: + kw fn + kw self:: + kw type + kw unsafe + "#]], + ); +} + +#[test] +fn in_trait_assoc_const_missing_body() { + check( + r#"trait Foo { const CONST: (); $0 }"#, + expect![[r#" + ma makro!(…) macro_rules! makro + md module + kw const + kw crate:: + kw fn + kw self:: + kw type + kw unsafe + "#]], + ); +} + +#[test] +fn in_trait_assoc_type_aliases_missing_ty() { + check( + r#"trait Foo { type Type; $0 }"#, + expect![[r#" + ma makro!(…) macro_rules! makro + md module + kw const + kw crate:: + kw fn + kw self:: + kw type + kw unsafe + "#]], + ); +} + #[test] fn in_trait_impl_assoc_item_list() { check(