3881: Add functional update test r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-04-07 16:26:49 +00:00 committed by GitHub
commit 173dccc804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,7 @@ fn pattern_ascribed_fields(record_pat: &ast::RecordPat) -> Vec<SmolStr> {
#[cfg(test)]
mod tests {
mod record_lit_tests {
mod record_pat_tests {
use insta::assert_debug_snapshot;
use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
@ -205,7 +205,7 @@ mod tests {
}
}
mod record_pat_tests {
mod record_lit_tests {
use insta::assert_debug_snapshot;
use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
@ -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",
},
]
"###);
}
}
}