1 use expect_test
::{expect, Expect}
;
3 use crate::tests
::completion_list
;
5 fn check(ra_fixture
: &str, expect
: Expect
) {
6 let actual
= completion_list(ra_fixture
);
7 expect
.assert_eq(&actual
);
11 fn without_default_impl() {
14 struct Struct { foo: u32, bar: usize }
30 fn record_pattern_field() {
33 struct Struct { foo: u32, bar: u32 }
37 Struct { foo, $0: 92 } => (),
50 fn pattern_enum_variant() {
53 enum Enum { Variant { foo: u32, bar: u32 } }
56 Enum::Variant { foo, $0 } => (),
69 fn record_literal_field_in_macro() {
72 macro_rules! m { ($e:expr) => { $e } }
73 struct Struct { field: u32 }
85 fn record_pattern_field_in_macro() {
88 macro_rules! m { ($e:expr) => { $e } }
89 struct Struct { field: u32 }
93 Struct { f$0: 92 } => (),
106 fn in_functional_update() {
107 cov_mark
::check
!(functional_update
);
112 struct Foo { foo1: u32, foo2: u32 }
113 impl Default for Foo {
114 fn default() -> Self { loop {} }
119 let foo = Foo { foo1: 0, foo2: 0 };
120 let foo2 = Foo { thing, ..$0 }
124 fd ..Default::default()
130 st Foo {…} Foo { foo1: u32, foo2: u32 }
140 struct Foo { foo1: u32, foo2: u32 }
141 impl Default for Foo {
142 fn default() -> Self { loop {} }
147 let foo = Foo { foo1: 0, foo2: 0 };
148 let foo2 = Foo { thing, ..Default::$0 }
152 fn default() (as Default) fn() -> Self
158 fn functional_update_no_dot() {
159 cov_mark
::check
!(functional_update_field
);
160 // FIXME: This should filter out all completions that do not have the type `Foo`
164 struct Foo { foo1: u32, foo2: u32 }
165 impl Default for Foo {
166 fn default() -> Self { loop {} }
171 let foo = Foo { foo1: 0, foo2: 0 };
172 let foo2 = Foo { thing, $0 }
176 fd ..Default::default()
184 fn functional_update_one_dot() {
185 cov_mark
::check
!(functional_update_one_dot
);
189 struct Foo { foo1: u32, foo2: u32 }
190 impl Default for Foo {
191 fn default() -> Self { loop {} }
196 let foo = Foo { foo1: 0, foo2: 0 };
197 let foo2 = Foo { thing, .$0 }
201 fd ..Default::default()
208 fn empty_union_literal() {
211 union Union { foo: u32, bar: f32 }
227 fn dont_suggest_additional_union_fields() {
230 union Union { foo: u32, bar: f32 }