Skip to content

Commit 4267c38

Browse files
Add tests for tuple struct field completion
1 parent 661961c commit 4267c38

File tree

1 file changed

+35
-1
lines changed
  • crates/ide_completion/src/completions

1 file changed

+35
-1
lines changed

crates/ide_completion/src/completions/dot.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,23 @@ fn foo(a: lib::m::A) { a.$0 }
213213
"#]],
214214
);
215215

216+
check(
217+
r#"
218+
//- /lib.rs crate:lib new_source_root:library
219+
pub mod m {
220+
pub struct A(
221+
i32,
222+
pub f64,
223+
);
224+
}
225+
//- /main.rs crate:main deps:lib new_source_root:local
226+
fn foo(a: lib::m::A) { a.$0 }
227+
"#,
228+
expect![[r#"
229+
fd 1 f64
230+
"#]],
231+
);
232+
216233
check(
217234
r#"
218235
//- /lib.rs crate:lib new_source_root:local
@@ -405,7 +422,24 @@ fn foo() {
405422
fd 0 i32
406423
fd 1 f64
407424
"#]],
408-
)
425+
);
426+
}
427+
428+
#[test]
429+
fn test_tuple_struct_field_completion() {
430+
check(
431+
r#"
432+
struct S(i32, f64);
433+
fn foo() {
434+
let b = S(0, 3.14);
435+
b.$0
436+
}
437+
"#,
438+
expect![[r#"
439+
fd 0 i32
440+
fd 1 f64
441+
"#]],
442+
);
409443
}
410444

411445
#[test]

0 commit comments

Comments
 (0)