Skip to content

Commit 21c09eb

Browse files
committed
update dot tests function with check_edit
1 parent 5c0c8ce commit 21c09eb

File tree

1 file changed

+33
-3
lines changed
  • crates/ide-completion/src/completions

1 file changed

+33
-3
lines changed

crates/ide-completion/src/completions/dot.rs

+33-3
Original file line numberDiff line numberDiff line change
@@ -1186,13 +1186,25 @@ impl<B: Bar, F: core::ops::Deref<Target = B>> Foo<F> {
11861186
fn test_struct_function_field_completion() {
11871187
check(
11881188
r#"
1189-
struct S { field: fn() }
1190-
fn foo() { S { field: || {} }.fi$0() }
1189+
struct S { va_field: u32, fn_field: fn() }
1190+
fn foo() { S { va_field: 0, fn_field: || {} }.fi$0() }
11911191
"#,
11921192
expect![[r#"
1193-
fd field fn()
1193+
fd fn_field fn()
11941194
"#]],
11951195
);
1196+
1197+
check_edit(
1198+
"fn_field",
1199+
r#"
1200+
struct S { va_field: u32, fn_field: fn() }
1201+
fn foo() { S { va_field: 0, fn_field: || {} }.fi$0() }
1202+
"#,
1203+
r#"
1204+
struct S { va_field: u32, fn_field: fn() }
1205+
fn foo() { (S { va_field: 0, fn_field: || {} }).fn_field() }
1206+
"#,
1207+
);
11961208
}
11971209

11981210
#[test]
@@ -1209,5 +1221,23 @@ fn foo() {
12091221
fd 1 fn()
12101222
"#]],
12111223
);
1224+
1225+
check_edit(
1226+
"1",
1227+
r#"
1228+
struct B(u32, fn())
1229+
fn foo() {
1230+
let b = B(0, || {});
1231+
b.$0()
1232+
}
1233+
"#,
1234+
r#"
1235+
struct B(u32, fn())
1236+
fn foo() {
1237+
let b = B(0, || {});
1238+
(b).1()
1239+
}
1240+
"#,
1241+
)
12121242
}
12131243
}

0 commit comments

Comments
 (0)