about summary refs log tree commit diff
diff options
context:
space:
mode:
authordfireBird <me@dfirebird.dev>2023-11-22 23:59:45 +0530
committerdfireBird <me@dfirebird.dev>2023-11-28 22:21:57 +0530
commit21c09eb5449ef972cd15bca4ca10e937e1c92f5a (patch)
tree71b53f51ecbc5cd2115fc2fa6599e33496363696
parent5c0c8ceaf7eba67355564bd54c7f4e215e485854 (diff)
update dot tests function with check_edit
-rw-r--r--crates/ide-completion/src/completions/dot.rs36
1 files changed, 33 insertions, 3 deletions
diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs
index e427be381bb..81acfc8ecff 100644
--- a/crates/ide-completion/src/completions/dot.rs
+++ b/crates/ide-completion/src/completions/dot.rs
@@ -1186,13 +1186,25 @@ impl<B: Bar, F: core::ops::Deref<Target = B>> Foo<F> {
     fn test_struct_function_field_completion() {
         check(
             r#"
-struct S { field: fn() }
-fn foo() { S { field: || {} }.fi$0() }
+struct S { va_field: u32, fn_field: fn() }
+fn foo() { S { va_field: 0, fn_field: || {} }.fi$0() }
 "#,
             expect![[r#"
-                fd field fn()
+                fd fn_field fn()
             "#]],
         );
+
+        check_edit(
+            "fn_field",
+            r#"
+struct S { va_field: u32, fn_field: fn() }
+fn foo() { S { va_field: 0, fn_field: || {} }.fi$0() }
+"#,
+            r#"
+struct S { va_field: u32, fn_field: fn() }
+fn foo() { (S { va_field: 0, fn_field: || {} }).fn_field() }
+"#,
+        );
     }
 
     #[test]
@@ -1209,5 +1221,23 @@ fn foo() {
                 fd 1 fn()
             "#]],
         );
+
+        check_edit(
+            "1",
+            r#"
+struct B(u32, fn())
+fn foo() {
+   let b = B(0, || {});
+   b.$0()
+}
+"#,
+            r#"
+struct B(u32, fn())
+fn foo() {
+   let b = B(0, || {});
+   (b).1()
+}
+"#,
+        )
     }
 }