diff options
author | Lukas Wirth <[email protected]> | 2021-06-21 13:59:49 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-21 14:00:53 +0100 |
commit | b9d85f55b7a0a2159971b42bb5dae71efbfeada4 (patch) | |
tree | ebfd374c1ae86a02cb9e51769d36f03fdeaf5977 /crates/ide_completion/src/completions | |
parent | f835279b3ae41644e9568187b4468cd9d9e84eca (diff) |
Move out completion type position tests
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/qualified_path.rs | 76 | ||||
-rw-r--r-- | crates/ide_completion/src/completions/unqualified_path.rs | 97 |
2 files changed, 0 insertions, 173 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs index f5dbd203b..1b8997ecf 100644 --- a/crates/ide_completion/src/completions/qualified_path.rs +++ b/crates/ide_completion/src/completions/qualified_path.rs | |||
@@ -219,36 +219,6 @@ mod tests { | |||
219 | } | 219 | } |
220 | 220 | ||
221 | #[test] | 221 | #[test] |
222 | fn dont_complete_values_in_type_pos() { | ||
223 | check( | ||
224 | r#" | ||
225 | const FOO: () = (); | ||
226 | static BAR: () = (); | ||
227 | struct Baz; | ||
228 | fn foo() { | ||
229 | let _: self::$0; | ||
230 | } | ||
231 | "#, | ||
232 | expect![[r#" | ||
233 | st Baz | ||
234 | "#]], | ||
235 | ); | ||
236 | } | ||
237 | |||
238 | #[test] | ||
239 | fn dont_complete_enum_variants_in_type_pos() { | ||
240 | check( | ||
241 | r#" | ||
242 | enum Foo { Bar } | ||
243 | fn foo() { | ||
244 | let _: Foo::$0; | ||
245 | } | ||
246 | "#, | ||
247 | expect![[r#""#]], | ||
248 | ); | ||
249 | } | ||
250 | |||
251 | #[test] | ||
252 | fn dont_complete_primitive_in_use() { | 222 | fn dont_complete_primitive_in_use() { |
253 | check_builtin(r#"use self::$0;"#, expect![[""]]); | 223 | check_builtin(r#"use self::$0;"#, expect![[""]]); |
254 | } | 224 | } |
@@ -259,32 +229,6 @@ fn foo() { | |||
259 | } | 229 | } |
260 | 230 | ||
261 | #[test] | 231 | #[test] |
262 | fn completes_primitives() { | ||
263 | check_builtin( | ||
264 | r#"fn main() { let _: $0 = 92; }"#, | ||
265 | expect![[r#" | ||
266 | bt u32 | ||
267 | bt bool | ||
268 | bt u8 | ||
269 | bt isize | ||
270 | bt u16 | ||
271 | bt u64 | ||
272 | bt u128 | ||
273 | bt f32 | ||
274 | bt i128 | ||
275 | bt i16 | ||
276 | bt str | ||
277 | bt i64 | ||
278 | bt char | ||
279 | bt f64 | ||
280 | bt i32 | ||
281 | bt i8 | ||
282 | bt usize | ||
283 | "#]], | ||
284 | ); | ||
285 | } | ||
286 | |||
287 | #[test] | ||
288 | fn completes_enum_variant() { | 232 | fn completes_enum_variant() { |
289 | check( | 233 | check( |
290 | r#" | 234 | r#" |
@@ -749,24 +693,4 @@ fn main() { | |||
749 | "#]], | 693 | "#]], |
750 | ); | 694 | ); |
751 | } | 695 | } |
752 | |||
753 | #[test] | ||
754 | fn completes_types_and_const_in_arg_list() { | ||
755 | check( | ||
756 | r#" | ||
757 | mod foo { | ||
758 | pub const CONST: () = (); | ||
759 | pub type Type = (); | ||
760 | } | ||
761 | |||
762 | struct Foo<T>(t); | ||
763 | |||
764 | fn foo(_: Foo<foo::$0>) {} | ||
765 | "#, | ||
766 | expect![[r#" | ||
767 | ta Type | ||
768 | ct CONST | ||
769 | "#]], | ||
770 | ); | ||
771 | } | ||
772 | } | 696 | } |
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 819fa3a43..380c1e079 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs | |||
@@ -113,28 +113,6 @@ mod tests { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | #[test] | 115 | #[test] |
116 | fn dont_complete_values_in_type_pos() { | ||
117 | check( | ||
118 | r#" | ||
119 | const FOO: () = (); | ||
120 | static BAR: () = (); | ||
121 | enum Foo { | ||
122 | Bar | ||
123 | } | ||
124 | struct Baz; | ||
125 | fn foo() { | ||
126 | let local = (); | ||
127 | let _: $0; | ||
128 | } | ||
129 | "#, | ||
130 | expect![[r#" | ||
131 | en Foo | ||
132 | st Baz | ||
133 | "#]], | ||
134 | ); | ||
135 | } | ||
136 | |||
137 | #[test] | ||
138 | fn completes_bindings_from_let() { | 116 | fn completes_bindings_from_let() { |
139 | check( | 117 | check( |
140 | r#" | 118 | r#" |
@@ -239,29 +217,6 @@ fn main() { | |||
239 | } | 217 | } |
240 | 218 | ||
241 | #[test] | 219 | #[test] |
242 | fn completes_generic_params_in_struct() { | ||
243 | check( | ||
244 | r#"struct S<T> { x: $0}"#, | ||
245 | expect![[r#" | ||
246 | sp Self | ||
247 | tp T | ||
248 | st S<…> | ||
249 | "#]], | ||
250 | ); | ||
251 | } | ||
252 | |||
253 | #[test] | ||
254 | fn completes_self_in_enum() { | ||
255 | check( | ||
256 | r#"enum X { Y($0) }"#, | ||
257 | expect![[r#" | ||
258 | sp Self | ||
259 | en X | ||
260 | "#]], | ||
261 | ); | ||
262 | } | ||
263 | |||
264 | #[test] | ||
265 | fn completes_module_items() { | 220 | fn completes_module_items() { |
266 | check( | 221 | check( |
267 | r#" | 222 | r#" |
@@ -315,19 +270,6 @@ mod m { | |||
315 | } | 270 | } |
316 | 271 | ||
317 | #[test] | 272 | #[test] |
318 | fn completes_return_type() { | ||
319 | check( | ||
320 | r#" | ||
321 | struct Foo; | ||
322 | fn x() -> $0 | ||
323 | "#, | ||
324 | expect![[r#" | ||
325 | st Foo | ||
326 | "#]], | ||
327 | ); | ||
328 | } | ||
329 | |||
330 | #[test] | ||
331 | fn dont_show_both_completions_for_shadowing() { | 273 | fn dont_show_both_completions_for_shadowing() { |
332 | check( | 274 | check( |
333 | r#" | 275 | r#" |
@@ -509,19 +451,6 @@ fn foo() { $0 } | |||
509 | } | 451 | } |
510 | 452 | ||
511 | #[test] | 453 | #[test] |
512 | fn completes_macros_as_type() { | ||
513 | check( | ||
514 | r#" | ||
515 | macro_rules! foo { () => {} } | ||
516 | fn main() { let x: $0 } | ||
517 | "#, | ||
518 | expect![[r#" | ||
519 | ma foo!(…) macro_rules! foo | ||
520 | "#]], | ||
521 | ); | ||
522 | } | ||
523 | |||
524 | #[test] | ||
525 | fn completes_macros_as_stmt() { | 454 | fn completes_macros_as_stmt() { |
526 | check( | 455 | check( |
527 | r#" | 456 | r#" |
@@ -666,30 +595,4 @@ fn f() {} | |||
666 | expect![[""]], | 595 | expect![[""]], |
667 | ) | 596 | ) |
668 | } | 597 | } |
669 | |||
670 | #[test] | ||
671 | fn completes_types_and_const_in_arg_list() { | ||
672 | check( | ||
673 | r#" | ||
674 | enum Bar { | ||
675 | Baz | ||
676 | } | ||
677 | trait Foo { | ||
678 | type Bar; | ||
679 | } | ||
680 | |||
681 | const CONST: () = (); | ||
682 | |||
683 | fn foo<T: Foo<$0>, const CONST_PARAM: usize>(_: T) {} | ||
684 | "#, | ||
685 | expect![[r#" | ||
686 | ta Bar = type Bar; | ||
687 | tp T | ||
688 | cp CONST_PARAM | ||
689 | tt Foo | ||
690 | en Bar | ||
691 | ct CONST | ||
692 | "#]], | ||
693 | ); | ||
694 | } | ||
695 | } | 598 | } |