diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-17 14:44:38 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-17 14:44:38 +0100 |
commit | 3ae0c5911ab50ee209179ee4329b0551abe6fc48 (patch) | |
tree | 8c8fb1436a64a6bfd56558f41b734a966aa5725e /crates/ide_completion/src/completions/mod_.rs | |
parent | c82a9141abe6b6cbf5b55710dc8a315a3839081b (diff) | |
parent | 2a48b532208de413e4e5d39e81c33a4644ecaa22 (diff) |
Merge #9312
9312: internal: Move out item specific completion tests r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/completions/mod_.rs')
-rw-r--r-- | crates/ide_completion/src/completions/mod_.rs | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/crates/ide_completion/src/completions/mod_.rs b/crates/ide_completion/src/completions/mod_.rs index 5def0d06a..1c864c0e7 100644 --- a/crates/ide_completion/src/completions/mod_.rs +++ b/crates/ide_completion/src/completions/mod_.rs | |||
@@ -141,11 +141,11 @@ fn module_chain_to_containing_module_file( | |||
141 | 141 | ||
142 | #[cfg(test)] | 142 | #[cfg(test)] |
143 | mod tests { | 143 | mod tests { |
144 | use crate::{tests::filtered_completion_list, CompletionKind}; | 144 | use crate::tests::completion_list; |
145 | use expect_test::{expect, Expect}; | 145 | use expect_test::{expect, Expect}; |
146 | 146 | ||
147 | fn check(ra_fixture: &str, expect: Expect) { | 147 | fn check(ra_fixture: &str, expect: Expect) { |
148 | let actual = filtered_completion_list(ra_fixture, CompletionKind::Magic); | 148 | let actual = completion_list(ra_fixture); |
149 | expect.assert_eq(&actual); | 149 | expect.assert_eq(&actual); |
150 | } | 150 | } |
151 | 151 | ||
@@ -153,17 +153,17 @@ mod tests { | |||
153 | fn lib_module_completion() { | 153 | fn lib_module_completion() { |
154 | check( | 154 | check( |
155 | r#" | 155 | r#" |
156 | //- /lib.rs | 156 | //- /lib.rs |
157 | mod $0 | 157 | mod $0 |
158 | //- /foo.rs | 158 | //- /foo.rs |
159 | fn foo() {} | 159 | fn foo() {} |
160 | //- /foo/ignored_foo.rs | 160 | //- /foo/ignored_foo.rs |
161 | fn ignored_foo() {} | 161 | fn ignored_foo() {} |
162 | //- /bar/mod.rs | 162 | //- /bar/mod.rs |
163 | fn bar() {} | 163 | fn bar() {} |
164 | //- /bar/ignored_bar.rs | 164 | //- /bar/ignored_bar.rs |
165 | fn ignored_bar() {} | 165 | fn ignored_bar() {} |
166 | "#, | 166 | "#, |
167 | expect![[r#" | 167 | expect![[r#" |
168 | md foo; | 168 | md foo; |
169 | md bar; | 169 | md bar; |
@@ -175,13 +175,13 @@ mod tests { | |||
175 | fn no_module_completion_with_module_body() { | 175 | fn no_module_completion_with_module_body() { |
176 | check( | 176 | check( |
177 | r#" | 177 | r#" |
178 | //- /lib.rs | 178 | //- /lib.rs |
179 | mod $0 { | 179 | mod $0 { |
180 | 180 | ||
181 | } | 181 | } |
182 | //- /foo.rs | 182 | //- /foo.rs |
183 | fn foo() {} | 183 | fn foo() {} |
184 | "#, | 184 | "#, |
185 | expect![[r#""#]], | 185 | expect![[r#""#]], |
186 | ); | 186 | ); |
187 | } | 187 | } |
@@ -190,17 +190,17 @@ mod tests { | |||
190 | fn main_module_completion() { | 190 | fn main_module_completion() { |
191 | check( | 191 | check( |
192 | r#" | 192 | r#" |
193 | //- /main.rs | 193 | //- /main.rs |
194 | mod $0 | 194 | mod $0 |
195 | //- /foo.rs | 195 | //- /foo.rs |
196 | fn foo() {} | 196 | fn foo() {} |
197 | //- /foo/ignored_foo.rs | 197 | //- /foo/ignored_foo.rs |
198 | fn ignored_foo() {} | 198 | fn ignored_foo() {} |
199 | //- /bar/mod.rs | 199 | //- /bar/mod.rs |
200 | fn bar() {} | 200 | fn bar() {} |
201 | //- /bar/ignored_bar.rs | 201 | //- /bar/ignored_bar.rs |
202 | fn ignored_bar() {} | 202 | fn ignored_bar() {} |
203 | "#, | 203 | "#, |
204 | expect![[r#" | 204 | expect![[r#" |
205 | md foo; | 205 | md foo; |
206 | md bar; | 206 | md bar; |
@@ -212,13 +212,13 @@ mod tests { | |||
212 | fn main_test_module_completion() { | 212 | fn main_test_module_completion() { |
213 | check( | 213 | check( |
214 | r#" | 214 | r#" |
215 | //- /main.rs | 215 | //- /main.rs |
216 | mod tests { | 216 | mod tests { |
217 | mod $0; | 217 | mod $0; |
218 | } | 218 | } |
219 | //- /tests/foo.rs | 219 | //- /tests/foo.rs |
220 | fn foo() {} | 220 | fn foo() {} |
221 | "#, | 221 | "#, |
222 | expect![[r#" | 222 | expect![[r#" |
223 | md foo | 223 | md foo |
224 | "#]], | 224 | "#]], |
@@ -229,19 +229,19 @@ mod tests { | |||
229 | fn directly_nested_module_completion() { | 229 | fn directly_nested_module_completion() { |
230 | check( | 230 | check( |
231 | r#" | 231 | r#" |
232 | //- /lib.rs | 232 | //- /lib.rs |
233 | mod foo; | 233 | mod foo; |
234 | //- /foo.rs | 234 | //- /foo.rs |
235 | mod $0; | 235 | mod $0; |
236 | //- /foo/bar.rs | 236 | //- /foo/bar.rs |
237 | fn bar() {} | 237 | fn bar() {} |
238 | //- /foo/bar/ignored_bar.rs | 238 | //- /foo/bar/ignored_bar.rs |
239 | fn ignored_bar() {} | 239 | fn ignored_bar() {} |
240 | //- /foo/baz/mod.rs | 240 | //- /foo/baz/mod.rs |
241 | fn baz() {} | 241 | fn baz() {} |
242 | //- /foo/moar/ignored_moar.rs | 242 | //- /foo/moar/ignored_moar.rs |
243 | fn ignored_moar() {} | 243 | fn ignored_moar() {} |
244 | "#, | 244 | "#, |
245 | expect![[r#" | 245 | expect![[r#" |
246 | md bar | 246 | md bar |
247 | md baz | 247 | md baz |
@@ -253,15 +253,15 @@ mod tests { | |||
253 | fn nested_in_source_module_completion() { | 253 | fn nested_in_source_module_completion() { |
254 | check( | 254 | check( |
255 | r#" | 255 | r#" |
256 | //- /lib.rs | 256 | //- /lib.rs |
257 | mod foo; | 257 | mod foo; |
258 | //- /foo.rs | 258 | //- /foo.rs |
259 | mod bar { | 259 | mod bar { |
260 | mod $0 | 260 | mod $0 |
261 | } | 261 | } |
262 | //- /foo/bar/baz.rs | 262 | //- /foo/bar/baz.rs |
263 | fn baz() {} | 263 | fn baz() {} |
264 | "#, | 264 | "#, |
265 | expect![[r#" | 265 | expect![[r#" |
266 | md baz; | 266 | md baz; |
267 | "#]], | 267 | "#]], |
@@ -299,16 +299,16 @@ mod tests { | |||
299 | fn already_declared_bin_module_completion_omitted() { | 299 | fn already_declared_bin_module_completion_omitted() { |
300 | check( | 300 | check( |
301 | r#" | 301 | r#" |
302 | //- /src/bin.rs crate:main | 302 | //- /src/bin.rs crate:main |
303 | fn main() {} | 303 | fn main() {} |
304 | //- /src/bin/foo.rs | 304 | //- /src/bin/foo.rs |
305 | mod $0 | 305 | mod $0 |
306 | //- /src/bin/bar.rs | 306 | //- /src/bin/bar.rs |
307 | mod foo; | 307 | mod foo; |
308 | fn bar() {} | 308 | fn bar() {} |
309 | //- /src/bin/bar/bar_ignored.rs | 309 | //- /src/bin/bar/bar_ignored.rs |
310 | fn bar_ignored() {} | 310 | fn bar_ignored() {} |
311 | "#, | 311 | "#, |
312 | expect![[r#""#]], | 312 | expect![[r#""#]], |
313 | ); | 313 | ); |
314 | } | 314 | } |