From 0ad13b9477fc6b15cbfbd521a79ea97bc0e79953 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 30 Dec 2018 00:03:52 +0100 Subject: Add a test for self field completion Needed to add a default crate graph in the analysis for that. --- crates/ra_analysis/src/completion/complete_dot.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/ra_analysis/src/completion/complete_dot.rs') diff --git a/crates/ra_analysis/src/completion/complete_dot.rs b/crates/ra_analysis/src/completion/complete_dot.rs index f24835d17..031d8b98f 100644 --- a/crates/ra_analysis/src/completion/complete_dot.rs +++ b/crates/ra_analysis/src/completion/complete_dot.rs @@ -72,6 +72,21 @@ mod tests { ); } + #[test] + fn test_struct_field_completion_self() { + check_ref_completion( + r" + struct A { the_field: u32 } + impl A { + fn foo(self) { + self.<|> + } + } + ", + r#"the_field"#, + ); + } + #[test] fn test_no_struct_field_completion_for_method_call() { check_ref_completion( -- cgit v1.2.3