Merge #3881
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:
commit
173dccc804
1 changed files with 35 additions and 2 deletions
|
|
@ -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",
|
||||
},
|
||||
]
|
||||
"###);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue