diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_record_literal.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_record_literal.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_record_literal.rs b/crates/ra_ide_api/src/completion/complete_record_literal.rs index 4406695d5..33bea411f 100644 --- a/crates/ra_ide_api/src/completion/complete_record_literal.rs +++ b/crates/ra_ide_api/src/completion/complete_record_literal.rs | |||
@@ -32,6 +32,34 @@ mod tests { | |||
32 | } | 32 | } |
33 | 33 | ||
34 | #[test] | 34 | #[test] |
35 | fn test_record_literal_deprecated_field() { | ||
36 | let completions = complete( | ||
37 | r" | ||
38 | struct A { | ||
39 | #[deprecated] | ||
40 | the_field: u32, | ||
41 | } | ||
42 | fn foo() { | ||
43 | A { the<|> } | ||
44 | } | ||
45 | ", | ||
46 | ); | ||
47 | assert_debug_snapshot!(completions, @r###" | ||
48 | ⋮[ | ||
49 | ⋮ CompletionItem { | ||
50 | ⋮ label: "the_field", | ||
51 | ⋮ source_range: [142; 145), | ||
52 | ⋮ delete: [142; 145), | ||
53 | ⋮ insert: "the_field", | ||
54 | ⋮ kind: Field, | ||
55 | ⋮ detail: "u32", | ||
56 | ⋮ deprecated: true, | ||
57 | ⋮ }, | ||
58 | ⋮] | ||
59 | "###); | ||
60 | } | ||
61 | |||
62 | #[test] | ||
35 | fn test_record_literal_field() { | 63 | fn test_record_literal_field() { |
36 | let completions = complete( | 64 | let completions = complete( |
37 | r" | 65 | r" |
@@ -50,6 +78,7 @@ mod tests { | |||
50 | ⋮ insert: "the_field", | 78 | ⋮ insert: "the_field", |
51 | ⋮ kind: Field, | 79 | ⋮ kind: Field, |
52 | ⋮ detail: "u32", | 80 | ⋮ detail: "u32", |
81 | ⋮ deprecated: false, | ||
53 | ⋮ }, | 82 | ⋮ }, |
54 | ⋮] | 83 | ⋮] |
55 | "###); | 84 | "###); |
@@ -76,6 +105,7 @@ mod tests { | |||
76 | ⋮ insert: "a", | 105 | ⋮ insert: "a", |
77 | ⋮ kind: Field, | 106 | ⋮ kind: Field, |
78 | ⋮ detail: "u32", | 107 | ⋮ detail: "u32", |
108 | ⋮ deprecated: false, | ||
79 | ⋮ }, | 109 | ⋮ }, |
80 | ⋮] | 110 | ⋮] |
81 | "###); | 111 | "###); |
@@ -102,6 +132,7 @@ mod tests { | |||
102 | ⋮ insert: "b", | 132 | ⋮ insert: "b", |
103 | ⋮ kind: Field, | 133 | ⋮ kind: Field, |
104 | ⋮ detail: "u32", | 134 | ⋮ detail: "u32", |
135 | ⋮ deprecated: false, | ||
105 | ⋮ }, | 136 | ⋮ }, |
106 | ⋮] | 137 | ⋮] |
107 | "###); | 138 | "###); |
@@ -127,6 +158,7 @@ mod tests { | |||
127 | ⋮ insert: "a", | 158 | ⋮ insert: "a", |
128 | ⋮ kind: Field, | 159 | ⋮ kind: Field, |
129 | ⋮ detail: "u32", | 160 | ⋮ detail: "u32", |
161 | ⋮ deprecated: false, | ||
130 | ⋮ }, | 162 | ⋮ }, |
131 | ⋮] | 163 | ⋮] |
132 | "###); | 164 | "###); |