Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/item.rs')
-rw-r--r--crates/ide-completion/src/tests/item.rs52
1 files changed, 50 insertions, 2 deletions
diff --git a/crates/ide-completion/src/tests/item.rs b/crates/ide-completion/src/tests/item.rs
index 61a9da8c27..45024ad216 100644
--- a/crates/ide-completion/src/tests/item.rs
+++ b/crates/ide-completion/src/tests/item.rs
@@ -116,8 +116,23 @@ fn completes_where() {
check_with_base_items(
r"fn func() $0",
expect![[r#"
- kw where
- "#]],
+ en Enum (adds ->) Enum
+ ma makro!(…) macro_rules! makro
+ md module (adds ->)
+ st Record (adds ->) Record
+ st Tuple (adds ->) Tuple
+ st Unit (adds ->) Unit
+ tt Trait (adds ->)
+ un Union (adds ->) Union
+ bt u32 (adds ->) u32
+ kw crate:: (adds ->)
+ kw dyn (adds ->)
+ kw fn (adds ->)
+ kw for (adds ->)
+ kw impl (adds ->)
+ kw self:: (adds ->)
+ kw where
+ "#]],
);
check_with_base_items(
r"enum Enum $0",
@@ -244,6 +259,19 @@ impl Copy for S where $0
}
#[test]
+fn fn_item_where_kw() {
+ check_edit(
+ "where",
+ r#"
+fn foo() $0
+"#,
+ r#"
+fn foo() where $0
+"#,
+ );
+}
+
+#[test]
fn test_is_not_considered_macro() {
check_with_base_items(
r#"
@@ -352,3 +380,23 @@ foo!(f$0);
"#]],
);
}
+
+#[test]
+fn completes_variant_through_hidden_enum_alias() {
+ check(
+ r#"
+//- /lib.rs crate:dep
+#[doc(hidden)]
+pub enum Foo { Variant }
+pub type Bar = Foo;
+
+//- /main.rs crate:main deps:dep
+fn main() {
+ let x = dep::Bar::V$0;
+}
+"#,
+ expect![[r#"
+ ev Variant Variant
+ "#]],
+ );
+}