From 7819d99d6bc617ee8653e9dc2fa4d82072d6c594 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 7 Apr 2020 18:25:47 +0200 Subject: Add functional update test --- crates/ra_ide/src/completion/complete_record.rs | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'crates/ra_ide/src/completion') diff --git a/crates/ra_ide/src/completion/complete_record.rs b/crates/ra_ide/src/completion/complete_record.rs index b180e2388..2352ced5f 100644 --- a/crates/ra_ide/src/completion/complete_record.rs +++ b/crates/ra_ide/src/completion/complete_record.rs @@ -410,5 +410,38 @@ mod tests { ] "###); } + + #[test] + fn completes_functional_update() { + let completions = complete( + r" + struct S { + foo1: u32, + foo2: u32, + } + + fn main() { + let foo1 = 1; + let s = S { + foo1, + <|> + .. loop {} + } + } + ", + ); + assert_debug_snapshot!(completions, @r###" + [ + CompletionItem { + label: "foo2", + source_range: [221; 221), + delete: [221; 221), + insert: "foo2", + kind: Field, + detail: "u32", + }, + ] + "###); + } } } -- cgit v1.2.3