aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/tests
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-17 12:56:55 +0100
committerLukas Wirth <[email protected]>2021-06-17 12:56:55 +0100
commit2225db2eb48bd8c8fdf399c50652d3f95c851ace (patch)
tree31a419449dff7bb0112ae328de2e4fdec755326d /crates/ide_completion/src/tests
parente14f5cfff04942f45a4af3b45152df9672b3458a (diff)
Refine `self`, `super` and `crate` completion in use paths
Diffstat (limited to 'crates/ide_completion/src/tests')
-rw-r--r--crates/ide_completion/src/tests/use_tree.rs29
1 files changed, 3 insertions, 26 deletions
diff --git a/crates/ide_completion/src/tests/use_tree.rs b/crates/ide_completion/src/tests/use_tree.rs
index 156ca244d..878bc42bf 100644
--- a/crates/ide_completion/src/tests/use_tree.rs
+++ b/crates/ide_completion/src/tests/use_tree.rs
@@ -20,10 +20,9 @@ mod foo {}
20//- /other_crate/lib.rs crate:other_crate 20//- /other_crate/lib.rs crate:other_crate
21// nothing here 21// nothing here
22"#, 22"#,
23 // FIXME: self in this case should also get the colons
24 expect![[r#" 23 expect![[r#"
25 kw crate:: 24 kw crate::
26 kw self 25 kw self::
27 kw super:: 26 kw super::
28 md foo 27 md foo
29 md other_crate 28 md other_crate
@@ -34,13 +33,7 @@ mod foo {}
34#[test] 33#[test]
35fn dont_complete_current_use() { 34fn dont_complete_current_use() {
36 cov_mark::check!(dont_complete_current_use); 35 cov_mark::check!(dont_complete_current_use);
37 // FIXME: self shouldn't be here 36 check(r#"use self::foo$0;"#, expect![[r#""#]]);
38 check(
39 r#"use self::foo$0;"#,
40 expect![[r#"
41 kw self
42 "#]],
43 );
44 check( 37 check(
45 r#" 38 r#"
46mod foo { pub struct S; } 39mod foo { pub struct S; }
@@ -56,7 +49,6 @@ use self::{foo::*, bar$0};
56 49
57#[test] 50#[test]
58fn nested_use_tree() { 51fn nested_use_tree() {
59 // FIXME: self shouldn't be here
60 check( 52 check(
61 r#" 53 r#"
62mod foo { 54mod foo {
@@ -67,7 +59,6 @@ mod foo {
67use foo::{bar::$0} 59use foo::{bar::$0}
68"#, 60"#,
69 expect![[r#" 61 expect![[r#"
70 kw self
71 st FooBar 62 st FooBar
72 "#]], 63 "#]],
73 ); 64 );
@@ -89,7 +80,6 @@ use foo::{$0}
89 80
90#[test] 81#[test]
91fn deeply_nested_use_tree() { 82fn deeply_nested_use_tree() {
92 // FIXME: self shouldn't be here
93 check( 83 check(
94 r#" 84 r#"
95mod foo { 85mod foo {
@@ -102,7 +92,6 @@ mod foo {
102use foo::{bar::{baz::$0}} 92use foo::{bar::{baz::$0}}
103"#, 93"#,
104 expect![[r#" 94 expect![[r#"
105 kw self
106 st FooBarBaz 95 st FooBarBaz
107 "#]], 96 "#]],
108 ); 97 );
@@ -126,7 +115,6 @@ use foo::{bar::{$0}}
126 115
127#[test] 116#[test]
128fn plain_qualified_use_tree() { 117fn plain_qualified_use_tree() {
129 // FIXME: self shouldn't be here
130 check( 118 check(
131 r#" 119 r#"
132use foo::$0 120use foo::$0
@@ -138,7 +126,6 @@ mod foo {
138struct Bar; 126struct Bar;
139"#, 127"#,
140 expect![[r#" 128 expect![[r#"
141 kw self
142 st Foo 129 st Foo
143 "#]], 130 "#]],
144 ); 131 );
@@ -146,7 +133,6 @@ struct Bar;
146 133
147#[test] 134#[test]
148fn self_qualified_use_tree() { 135fn self_qualified_use_tree() {
149 // FIXME: self shouldn't be here
150 check( 136 check(
151 r#" 137 r#"
152use self::$0 138use self::$0
@@ -155,7 +141,6 @@ mod foo {}
155struct Bar; 141struct Bar;
156"#, 142"#,
157 expect![[r#" 143 expect![[r#"
158 kw self
159 md foo 144 md foo
160 st Bar 145 st Bar
161 "#]], 146 "#]],
@@ -164,7 +149,6 @@ struct Bar;
164 149
165#[test] 150#[test]
166fn super_qualified_use_tree() { 151fn super_qualified_use_tree() {
167 // FIXME: self shouldn't be here
168 check( 152 check(
169 r#" 153 r#"
170mod bar { 154mod bar {
@@ -175,7 +159,6 @@ mod foo {}
175struct Bar; 159struct Bar;
176"#, 160"#,
177 expect![[r#" 161 expect![[r#"
178 kw self
179 kw super:: 162 kw super::
180 st Bar 163 st Bar
181 md bar 164 md bar
@@ -186,7 +169,6 @@ struct Bar;
186 169
187#[test] 170#[test]
188fn super_super_qualified_use_tree() { 171fn super_super_qualified_use_tree() {
189 // FIXME: self shouldn't be here
190 check( 172 check(
191 r#" 173 r#"
192mod a { 174mod a {
@@ -198,7 +180,6 @@ mod a {
198} 180}
199"#, 181"#,
200 expect![[r#" 182 expect![[r#"
201 kw self
202 kw super:: 183 kw super::
203 md b 184 md b
204 ct A 185 ct A
@@ -208,7 +189,6 @@ mod a {
208 189
209#[test] 190#[test]
210fn crate_qualified_use_tree() { 191fn crate_qualified_use_tree() {
211 // FIXME: self shouldn't be here
212 check( 192 check(
213 r#" 193 r#"
214use crate::$0 194use crate::$0
@@ -217,7 +197,6 @@ mod foo {}
217struct Bar; 197struct Bar;
218"#, 198"#,
219 expect![[r#" 199 expect![[r#"
220 kw self
221 md foo 200 md foo
222 st Bar 201 st Bar
223 "#]], 202 "#]],
@@ -226,7 +205,6 @@ struct Bar;
226 205
227#[test] 206#[test]
228fn extern_crate_qualified_use_tree() { 207fn extern_crate_qualified_use_tree() {
229 // FIXME: self shouldn't be here
230 check( 208 check(
231 r#" 209 r#"
232//- /lib.rs crate:main deps:other_crate 210//- /lib.rs crate:main deps:other_crate
@@ -236,7 +214,6 @@ pub struct Foo;
236pub mod foo {} 214pub mod foo {}
237"#, 215"#,
238 expect![[r#" 216 expect![[r#"
239 kw self
240 st Foo 217 st Foo
241 md foo 218 md foo
242 "#]], 219 "#]],
@@ -253,7 +230,7 @@ pub use $0;
253"#, 230"#,
254 expect![[r#" 231 expect![[r#"
255 kw crate:: 232 kw crate::
256 kw self 233 kw self::
257 kw super:: 234 kw super::
258 md bar 235 md bar
259 "#]], 236 "#]],