]> git.lizzy.rs Git - rust.git/blobdiff - crates/ide-completion/src/tests/pattern.rs
fix: format literal lookup
[rust.git] / crates / ide-completion / src / tests / pattern.rs
index 180886806600111e41dea94bf237d76ac566c859..85c4dbd6625dfcfc891a073c885eab6eec98780b 100644 (file)
@@ -443,7 +443,7 @@ fn foo() {
 }
 "#,
         expect![[r#"
-            bn TupleVariant(…) TupleVariant($1)$0
+            bn TupleVariant TupleVariant
         "#]],
     );
     check_empty(
@@ -458,7 +458,7 @@ fn foo() {
 }
 "#,
         expect![[r#"
-            bn RecordVariant {…} RecordVariant { field$1 }$0
+            bn RecordVariant RecordVariant
         "#]],
     );
 }
@@ -467,7 +467,7 @@ fn foo() {
 fn completes_enum_variant_pat() {
     cov_mark::check!(enum_variant_pattern_path);
     check_edit(
-        "RecordVariant {…}",
+        "RecordVariant{}",
         r#"
 enum Enum {
     RecordVariant { field: u32 }
@@ -630,3 +630,87 @@ fn f(v: u32) {
         "#]],
     );
 }
+
+#[test]
+fn in_method_param() {
+    check_empty(
+        r#"
+struct Ty(u8);
+
+impl Ty {
+    fn foo($0)
+}
+"#,
+        expect![[r#"
+            sp Self
+            st Ty
+            bn &mut self
+            bn &self
+            bn Self(…)   Self($1): Self$0
+            bn Ty(…)     Ty($1): Ty$0
+            bn mut self
+            bn self
+            kw mut
+            kw ref
+        "#]],
+    );
+    check_empty(
+        r#"
+struct Ty(u8);
+
+impl Ty {
+    fn foo(s$0)
+}
+"#,
+        expect![[r#"
+            sp Self
+            st Ty
+            bn &mut self
+            bn &self
+            bn Self(…)   Self($1): Self$0
+            bn Ty(…)     Ty($1): Ty$0
+            bn mut self
+            bn self
+            kw mut
+            kw ref
+        "#]],
+    );
+    check_empty(
+        r#"
+struct Ty(u8);
+
+impl Ty {
+    fn foo(s$0, foo: u8)
+}
+"#,
+        expect![[r#"
+            sp Self
+            st Ty
+            bn &mut self
+            bn &self
+            bn Self(…)   Self($1): Self$0
+            bn Ty(…)     Ty($1): Ty$0
+            bn mut self
+            bn self
+            kw mut
+            kw ref
+        "#]],
+    );
+    check_empty(
+        r#"
+struct Ty(u8);
+
+impl Ty {
+    fn foo(foo: u8, b$0)
+}
+"#,
+        expect![[r#"
+            sp Self
+            st Ty
+            bn Self(…) Self($1): Self$0
+            bn Ty(…)   Ty($1): Ty$0
+            kw mut
+            kw ref
+        "#]],
+    );
+}