update dot tests function with check_edit

This commit is contained in:
dfireBird 2023-11-22 23:59:45 +05:30
parent 5c0c8ceaf7
commit 21c09eb544
No known key found for this signature in database
GPG Key ID: 26D522CA5FC2B93D

View File

@ -1186,13 +1186,25 @@ fn foobar(&self) {
fn test_struct_function_field_completion() { fn test_struct_function_field_completion() {
check( check(
r#" r#"
struct S { field: fn() } struct S { va_field: u32, fn_field: fn() }
fn foo() { S { field: || {} }.fi$0() } fn foo() { S { va_field: 0, fn_field: || {} }.fi$0() }
"#, "#,
expect![[r#" 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] #[test]
@ -1209,5 +1221,23 @@ fn foo() {
fd 1 fn() 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()
}
"#,
)
} }
} }