aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-07 17:26:49 +0100
committerGitHub <[email protected]>2020-04-07 17:26:49 +0100
commit173dccc804e75da1c83532bc0dbb21f074777731 (patch)
tree13eecb6b4d76c758b5822bd4ef0573d37b943f7a /crates/ra_ide/src
parent33c364b545350134b945fbca834194fd1a28fe08 (diff)
parent7819d99d6bc617ee8653e9dc2fa4d82072d6c594 (diff)
Merge #3881
3881: Add functional update test r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/completion/complete_record.rs37
1 files changed, 35 insertions, 2 deletions
diff --git a/crates/ra_ide/src/completion/complete_record.rs b/crates/ra_ide/src/completion/complete_record.rs
index 79f5c8c8f..2352ced5f 100644
--- a/crates/ra_ide/src/completion/complete_record.rs
+++ b/crates/ra_ide/src/completion/complete_record.rs
@@ -59,7 +59,7 @@ fn pattern_ascribed_fields(record_pat: &ast::RecordPat) -> Vec<SmolStr> {
59 59
60#[cfg(test)] 60#[cfg(test)]
61mod tests { 61mod tests {
62 mod record_lit_tests { 62 mod record_pat_tests {
63 use insta::assert_debug_snapshot; 63 use insta::assert_debug_snapshot;
64 64
65 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind}; 65 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
@@ -205,7 +205,7 @@ mod tests {
205 } 205 }
206 } 206 }
207 207
208 mod record_pat_tests { 208 mod record_lit_tests {
209 use insta::assert_debug_snapshot; 209 use insta::assert_debug_snapshot;
210 210
211 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind}; 211 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
@@ -410,5 +410,38 @@ mod tests {
410 ] 410 ]
411 "###); 411 "###);
412 } 412 }
413
414 #[test]
415 fn completes_functional_update() {
416 let completions = complete(
417 r"
418 struct S {
419 foo1: u32,
420 foo2: u32,
421 }
422
423 fn main() {
424 let foo1 = 1;
425 let s = S {
426 foo1,
427 <|>
428 .. loop {}
429 }
430 }
431 ",
432 );
433 assert_debug_snapshot!(completions, @r###"
434 [
435 CompletionItem {
436 label: "foo2",
437 source_range: [221; 221),
438 delete: [221; 221),
439 insert: "foo2",
440 kind: Field,
441 detail: "u32",
442 },
443 ]
444 "###);
445 }
413 } 446 }
414} 447}