]> git.lizzy.rs Git - rust.git/blob - crates/ra_assists/src/doc_tests/generated.rs
2f36c3baa31ee3e15849ad4df69596d245ff81ae
[rust.git] / crates / ra_assists / src / doc_tests / generated.rs
1 //! Generated file, do not edit by hand, see `crate/ra_tools/src/codegen`
2
3 use super::check;
4
5 #[test]
6 fn doctest_add_derive() {
7     check(
8         "add_derive",
9         r#####"
10 struct Point {
11     x: u32,
12     y: u32,<|>
13 }
14 "#####,
15         r#####"
16 #[derive()]
17 struct Point {
18     x: u32,
19     y: u32,
20 }
21 "#####,
22     )
23 }
24
25 #[test]
26 fn doctest_add_explicit_type() {
27     check(
28         "add_explicit_type",
29         r#####"
30 fn main() {
31     let x<|> = 92;
32 }
33 "#####,
34         r#####"
35 fn main() {
36     let x: i32 = 92;
37 }
38 "#####,
39     )
40 }
41
42 #[test]
43 fn doctest_add_impl() {
44     check(
45         "add_impl",
46         r#####"
47 struct Ctx<T: Clone> {
48      data: T,<|>
49 }
50 "#####,
51         r#####"
52 struct Ctx<T: Clone> {
53      data: T,
54 }
55
56 impl<T: Clone> Ctx<T> {
57
58 }
59 "#####,
60     )
61 }
62
63 #[test]
64 fn doctest_add_impl_default_members() {
65     check(
66         "add_impl_default_members",
67         r#####"
68 trait T {
69     Type X;
70     fn foo(&self);
71     fn bar(&self) {}
72 }
73
74 impl T for () {
75     Type X = ();
76     fn foo(&self) {}<|>
77
78 }
79 "#####,
80         r#####"
81 trait T {
82     Type X;
83     fn foo(&self);
84     fn bar(&self) {}
85 }
86
87 impl T for () {
88     Type X = ();
89     fn foo(&self) {}
90     fn bar(&self) {}
91
92 }
93 "#####,
94     )
95 }
96
97 #[test]
98 fn doctest_add_impl_missing_members() {
99     check(
100         "add_impl_missing_members",
101         r#####"
102 trait T {
103     Type X;
104     fn foo(&self);
105     fn bar(&self) {}
106 }
107
108 impl T for () {<|>
109
110 }
111 "#####,
112         r#####"
113 trait T {
114     Type X;
115     fn foo(&self);
116     fn bar(&self) {}
117 }
118
119 impl T for () {
120     fn foo(&self) { unimplemented!() }
121
122 }
123 "#####,
124     )
125 }
126
127 #[test]
128 fn doctest_apply_demorgan() {
129     check(
130         "apply_demorgan",
131         r#####"
132 fn main() {
133     if x != 4 ||<|> !y {}
134 }
135 "#####,
136         r#####"
137 fn main() {
138     if !(x == 4 && y) {}
139 }
140 "#####,
141     )
142 }
143
144 #[test]
145 fn doctest_change_visibility() {
146     check(
147         "change_visibility",
148         r#####"
149 fn<|> frobnicate() {}
150 "#####,
151         r#####"
152 pub(crate) fn frobnicate() {}
153 "#####,
154     )
155 }
156
157 #[test]
158 fn doctest_convert_to_guarded_return() {
159     check(
160         "convert_to_guarded_return",
161         r#####"
162 fn main() {
163     <|>if cond {
164         foo();
165         bar();
166     }
167 }
168 "#####,
169         r#####"
170 fn main() {
171     if !cond {
172         return;
173     }
174     foo();
175     bar();
176 }
177 "#####,
178     )
179 }
180
181 #[test]
182 fn doctest_fill_match_arms() {
183     check(
184         "fill_match_arms",
185         r#####"
186 enum Action { Move { distance: u32 }, Stop }
187
188 fn handle(action: Action) {
189     match action {
190         <|>
191     }
192 }
193 "#####,
194         r#####"
195 enum Action { Move { distance: u32 }, Stop }
196
197 fn handle(action: Action) {
198     match action {
199         Action::Move{ distance } => (),
200         Action::Stop => (),
201     }
202 }
203 "#####,
204     )
205 }