Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/fn_param.rs')
-rw-r--r--crates/ide-completion/src/tests/fn_param.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/crates/ide-completion/src/tests/fn_param.rs b/crates/ide-completion/src/tests/fn_param.rs
index 451ce07c74..02cba6b646 100644
--- a/crates/ide-completion/src/tests/fn_param.rs
+++ b/crates/ide-completion/src/tests/fn_param.rs
@@ -85,7 +85,11 @@ pub(crate) trait SourceRoot {
}
"#,
expect![[r#"
+ bn &mut self
+ bn &self
bn file_id: usize
+ bn mut self
+ bn self
kw mut
kw ref
"#]],
@@ -183,6 +187,44 @@ impl A {
)
}
+#[test]
+fn in_trait_only_param() {
+ check(
+ r#"
+trait A {
+ fn foo(file_id: usize) {}
+ fn new($0) {}
+}
+"#,
+ expect![[r#"
+ bn &mut self
+ bn &self
+ bn file_id: usize
+ bn mut self
+ bn self
+ kw mut
+ kw ref
+ "#]],
+ )
+}
+
+#[test]
+fn in_trait_after_self() {
+ check(
+ r#"
+trait A {
+ fn foo(file_id: usize) {}
+ fn new(self, $0) {}
+}
+"#,
+ expect![[r#"
+ bn file_id: usize
+ kw mut
+ kw ref
+ "#]],
+ )
+}
+
// doesn't complete qux due to there being no expression after
// see source_analyzer::adjust comment
#[test]