diff options
author | Lukas Wirth <[email protected]> | 2021-06-17 14:43:21 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-17 14:43:21 +0100 |
commit | 2a48b532208de413e4e5d39e81c33a4644ecaa22 (patch) | |
tree | 8c8fb1436a64a6bfd56558f41b734a966aa5725e /crates/ide_completion/src/tests | |
parent | a9a77671f2405e0cb65160c17268beec5114e259 (diff) |
Correct completions in items tests
Diffstat (limited to 'crates/ide_completion/src/tests')
-rw-r--r-- | crates/ide_completion/src/tests/items.rs | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/crates/ide_completion/src/tests/items.rs b/crates/ide_completion/src/tests/items.rs index dd4ba3864..8dfb8221b 100644 --- a/crates/ide_completion/src/tests/items.rs +++ b/crates/ide_completion/src/tests/items.rs | |||
@@ -23,13 +23,11 @@ trait Trait {} | |||
23 | 23 | ||
24 | #[test] | 24 | #[test] |
25 | fn target_type_or_trait_in_impl_block() { | 25 | fn target_type_or_trait_in_impl_block() { |
26 | // FIXME: should not complete `Self` | ||
27 | check( | 26 | check( |
28 | r#" | 27 | r#" |
29 | impl My$0 | 28 | impl Tra$0 |
30 | "#, | 29 | "#, |
31 | expect![[r##" | 30 | expect![[r##" |
32 | sp Self | ||
33 | tt Trait | 31 | tt Trait |
34 | en Enum | 32 | en Enum |
35 | st Struct | 33 | st Struct |
@@ -58,36 +56,57 @@ impl My$0 | |||
58 | } | 56 | } |
59 | 57 | ||
60 | #[test] | 58 | #[test] |
61 | fn after_trait_name_in_trait_def() { | 59 | fn target_type_in_trait_impl_block() { |
62 | // FIXME: should only complete `where` | ||
63 | check( | 60 | check( |
64 | r"trait A $0", | 61 | r#" |
62 | impl Trait for Str$0 | ||
63 | "#, | ||
65 | expect![[r##" | 64 | expect![[r##" |
66 | kw where | 65 | tt Trait |
67 | sn tmod (Test module) | 66 | en Enum |
68 | sn tfn (Test function) | 67 | st Struct |
69 | sn macro_rules | ||
70 | md bar | 68 | md bar |
71 | ma foo!(…) #[macro_export] macro_rules! foo | 69 | ma foo!(…) #[macro_export] macro_rules! foo |
72 | ma foo!(…) #[macro_export] macro_rules! foo | 70 | ma foo!(…) #[macro_export] macro_rules! foo |
71 | bt u32 | ||
72 | bt bool | ||
73 | bt u8 | ||
74 | bt isize | ||
75 | bt u16 | ||
76 | bt u64 | ||
77 | bt u128 | ||
78 | bt f32 | ||
79 | bt i128 | ||
80 | bt i16 | ||
81 | bt str | ||
82 | bt i64 | ||
83 | bt char | ||
84 | bt f64 | ||
85 | bt i32 | ||
86 | bt i8 | ||
87 | bt usize | ||
73 | "##]], | 88 | "##]], |
89 | ) | ||
90 | } | ||
91 | |||
92 | #[test] | ||
93 | fn after_trait_name_in_trait_def() { | ||
94 | check( | ||
95 | r"trait A $0", | ||
96 | expect![[r#" | ||
97 | kw where | ||
98 | "#]], | ||
74 | ); | 99 | ); |
75 | } | 100 | } |
76 | 101 | ||
77 | #[test] | 102 | #[test] |
78 | fn after_trait_or_target_name_in_impl() { | 103 | fn after_trait_or_target_name_in_impl() { |
79 | // FIXME: should only complete `for` and `where` | ||
80 | check( | 104 | check( |
81 | r"impl A $0", | 105 | r"impl Trait $0", |
82 | expect![[r##" | 106 | expect![[r#" |
83 | kw where | 107 | kw where |
84 | sn tmod (Test module) | 108 | kw for |
85 | sn tfn (Test function) | 109 | "#]], |
86 | sn macro_rules | ||
87 | md bar | ||
88 | ma foo!(…) #[macro_export] macro_rules! foo | ||
89 | ma foo!(…) #[macro_export] macro_rules! foo | ||
90 | "##]], | ||
91 | ); | 110 | ); |
92 | } | 111 | } |
93 | 112 | ||