Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/special.rs')
-rw-r--r--crates/ide-completion/src/tests/special.rs94
1 files changed, 59 insertions, 35 deletions
diff --git a/crates/ide-completion/src/tests/special.rs b/crates/ide-completion/src/tests/special.rs
index d3dbd7cc22..f96fb71f28 100644
--- a/crates/ide-completion/src/tests/special.rs
+++ b/crates/ide-completion/src/tests/special.rs
@@ -84,10 +84,10 @@ pub mod prelude {
}
"#,
expect![[r#"
- md std
- st Option
- bt u32
- "#]],
+ md std
+ st Option Option
+ bt u32 u32
+ "#]],
);
}
@@ -112,11 +112,11 @@ mod macros {
}
"#,
expect![[r#"
- fn f() fn()
- ma concat!(…) macro_rules! concat
- md std
- bt u32
- "#]],
+ fn f() fn()
+ ma concat!(…) macro_rules! concat
+ md std
+ bt u32 u32
+ "#]],
);
}
@@ -142,11 +142,11 @@ pub mod prelude {
}
"#,
expect![[r#"
- md core
- md std
- st String
- bt u32
- "#]],
+ md core
+ md std
+ st String String
+ bt u32 u32
+ "#]],
);
}
@@ -171,10 +171,10 @@ pub mod prelude {
}
"#,
expect![[r#"
- fn f() fn()
- md std
- bt u32
- "#]],
+ fn f() fn()
+ md std
+ bt u32 u32
+ "#]],
);
}
@@ -446,10 +446,10 @@ mod p {
}
"#,
expect![[r#"
- ct RIGHT_CONST
- fn right_fn() fn()
- st RightType
- "#]],
+ ct RIGHT_CONST u32
+ fn right_fn() fn()
+ st RightType WrongType
+ "#]],
);
check_edit(
@@ -881,7 +881,7 @@ fn main() {
fn main() fn()
lc foobar i32
ma x!(…) macro_rules! x
- bt u32
+ bt u32 u32
"#]],
)
}
@@ -1008,8 +1008,8 @@ fn here_we_go() {
"#,
expect![[r#"
fn here_we_go() fn()
- st Foo (alias Bar)
- bt u32
+ st Foo (alias Bar) Foo
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1057,8 +1057,8 @@ fn here_we_go() {
"#,
expect![[r#"
fn here_we_go() fn()
- st Foo (alias Bar, Qux, Baz)
- bt u32
+ st Foo (alias Bar, Qux, Baz) Foo
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1178,7 +1178,7 @@ fn bar() { qu$0 }
expect![[r#"
fn bar() fn()
fn foo() (alias qux) fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1227,7 +1227,7 @@ fn here_we_go() {
}
"#,
expect![[r#"
- st Bar (alias Qux)
+ st Bar (alias Qux) Bar
"#]],
);
}
@@ -1246,7 +1246,7 @@ fn here_we_go() {
}
"#,
expect![[r#"
- st Bar (alias Qux)
+ st Bar (alias Qux) Bar
"#]],
);
}
@@ -1267,8 +1267,8 @@ fn here_we_go() {
expect![[r#"
fn here_we_go() fn()
md foo
- st Bar (alias Qux) (use foo::Bar)
- bt u32
+ st Bar (alias Qux) (use foo::Bar) Bar
+ bt u32 u32
kw crate::
kw false
kw for
@@ -1287,6 +1287,30 @@ fn here_we_go() {
}
#[test]
+fn completes_only_public() {
+ check(
+ r#"
+//- /e.rs
+pub(self) fn i_should_be_hidden() {}
+pub(in crate::e) fn i_should_also_be_hidden() {}
+pub fn i_am_public () {}
+
+//- /lib.rs crate:krate
+pub mod e;
+
+//- /main.rs deps:krate crate:main
+use krate::e;
+fn main() {
+ e::$0
+}"#,
+ expect![
+ "fn i_am_public() fn()
+"
+ ],
+ )
+}
+
+#[test]
fn completion_filtering_excludes_non_identifier_doc_aliases() {
check_edit(
"PartialOrdcmporder",
@@ -1409,7 +1433,7 @@ fn foo() {
Some('_'),
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1461,7 +1485,7 @@ fn foo(_: a_$0) { }
"#,
Some('_'),
expect![[r#"
- bt u32
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -1475,7 +1499,7 @@ fn foo<T>() {
Some('_'),
expect![[r#"
tp T
- bt u32
+ bt u32 u32
kw crate::
kw self::
"#]],