aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-16 20:45:02 +0100
committerLukas Wirth <[email protected]>2021-06-16 20:51:52 +0100
commitaa644b55859c6b5c6695a5d4fb35d1b6efbbebcc (patch)
tree47119538effd381ecd8e15d422103512f2b47406 /crates/ide_completion/src/completions
parent11115ebad8d0cb367478a4f154abe08c0c25aa95 (diff)
Move test_utils into tests module
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r--crates/ide_completion/src/completions/attribute.rs4
-rw-r--r--crates/ide_completion/src/completions/attribute/derive.rs4
-rw-r--r--crates/ide_completion/src/completions/attribute/lint.rs2
-rw-r--r--crates/ide_completion/src/completions/dot.rs4
-rw-r--r--crates/ide_completion/src/completions/flyimport.rs4
-rw-r--r--crates/ide_completion/src/completions/fn_param.rs4
-rw-r--r--crates/ide_completion/src/completions/keyword.rs4
-rw-r--r--crates/ide_completion/src/completions/lifetime.rs5
-rw-r--r--crates/ide_completion/src/completions/mod_.rs4
-rw-r--r--crates/ide_completion/src/completions/pattern.rs6
-rw-r--r--crates/ide_completion/src/completions/postfix.rs4
-rw-r--r--crates/ide_completion/src/completions/qualified_path.rs6
-rw-r--r--crates/ide_completion/src/completions/record.rs8
-rw-r--r--crates/ide_completion/src/completions/snippet.rs4
-rw-r--r--crates/ide_completion/src/completions/trait_impl.rs4
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs5
16 files changed, 37 insertions, 35 deletions
diff --git a/crates/ide_completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs
index 6df569c2a..3866c5917 100644
--- a/crates/ide_completion/src/completions/attribute.rs
+++ b/crates/ide_completion/src/completions/attribute.rs
@@ -322,7 +322,7 @@ mod tests {
322 322
323 use expect_test::{expect, Expect}; 323 use expect_test::{expect, Expect};
324 324
325 use crate::{test_utils::completion_list, CompletionKind}; 325 use crate::{tests::filtered_completion_list, CompletionKind};
326 326
327 #[test] 327 #[test]
328 fn attributes_are_sorted() { 328 fn attributes_are_sorted() {
@@ -341,7 +341,7 @@ mod tests {
341 } 341 }
342 342
343 fn check(ra_fixture: &str, expect: Expect) { 343 fn check(ra_fixture: &str, expect: Expect) {
344 let actual = completion_list(ra_fixture, CompletionKind::Attribute); 344 let actual = filtered_completion_list(ra_fixture, CompletionKind::Attribute);
345 expect.assert_eq(&actual); 345 expect.assert_eq(&actual);
346 } 346 }
347 347
diff --git a/crates/ide_completion/src/completions/attribute/derive.rs b/crates/ide_completion/src/completions/attribute/derive.rs
index 20bbbba46..5201095e8 100644
--- a/crates/ide_completion/src/completions/attribute/derive.rs
+++ b/crates/ide_completion/src/completions/attribute/derive.rs
@@ -82,7 +82,7 @@ const DEFAULT_DERIVE_COMPLETIONS: &[DeriveDependencies] = &[
82mod tests { 82mod tests {
83 use expect_test::{expect, Expect}; 83 use expect_test::{expect, Expect};
84 84
85 use crate::{test_utils::completion_list, CompletionKind}; 85 use crate::{tests::filtered_completion_list, CompletionKind};
86 86
87 fn check(ra_fixture: &str, expect: Expect) { 87 fn check(ra_fixture: &str, expect: Expect) {
88 let builtin_derives = r#" 88 let builtin_derives = r#"
@@ -106,7 +106,7 @@ pub macro PartialOrd {}
106pub macro Ord {} 106pub macro Ord {}
107 107
108"#; 108"#;
109 let actual = completion_list( 109 let actual = filtered_completion_list(
110 &format!("{} {}", builtin_derives, ra_fixture), 110 &format!("{} {}", builtin_derives, ra_fixture),
111 CompletionKind::Attribute, 111 CompletionKind::Attribute,
112 ); 112 );
diff --git a/crates/ide_completion/src/completions/attribute/lint.rs b/crates/ide_completion/src/completions/attribute/lint.rs
index ca99e9759..4812b075c 100644
--- a/crates/ide_completion/src/completions/attribute/lint.rs
+++ b/crates/ide_completion/src/completions/attribute/lint.rs
@@ -34,7 +34,7 @@ pub(super) fn complete_lint(
34#[cfg(test)] 34#[cfg(test)]
35mod tests { 35mod tests {
36 36
37 use crate::test_utils::check_edit; 37 use crate::tests::check_edit;
38 38
39 #[test] 39 #[test]
40 fn check_empty() { 40 fn check_empty() {
diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs
index 9552875c1..7f75d4298 100644
--- a/crates/ide_completion/src/completions/dot.rs
+++ b/crates/ide_completion/src/completions/dot.rs
@@ -101,10 +101,10 @@ fn complete_methods(
101mod tests { 101mod tests {
102 use expect_test::{expect, Expect}; 102 use expect_test::{expect, Expect};
103 103
104 use crate::{test_utils::completion_list, CompletionKind}; 104 use crate::{tests::filtered_completion_list, CompletionKind};
105 105
106 fn check(ra_fixture: &str, expect: Expect) { 106 fn check(ra_fixture: &str, expect: Expect) {
107 let actual = completion_list(ra_fixture, CompletionKind::Reference); 107 let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference);
108 expect.assert_eq(&actual); 108 expect.assert_eq(&actual);
109 } 109 }
110 110
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs
index 30b8d44bd..4604feb5d 100644
--- a/crates/ide_completion/src/completions/flyimport.rs
+++ b/crates/ide_completion/src/completions/flyimport.rs
@@ -227,11 +227,11 @@ mod tests {
227 227
228 use crate::{ 228 use crate::{
229 item::CompletionKind, 229 item::CompletionKind,
230 test_utils::{check_edit, check_edit_with_config, completion_list, TEST_CONFIG}, 230 tests::{check_edit, check_edit_with_config, filtered_completion_list, TEST_CONFIG},
231 }; 231 };
232 232
233 fn check(ra_fixture: &str, expect: Expect) { 233 fn check(ra_fixture: &str, expect: Expect) {
234 let actual = completion_list(ra_fixture, CompletionKind::Magic); 234 let actual = filtered_completion_list(ra_fixture, CompletionKind::Magic);
235 expect.assert_eq(&actual); 235 expect.assert_eq(&actual);
236 } 236 }
237 237
diff --git a/crates/ide_completion/src/completions/fn_param.rs b/crates/ide_completion/src/completions/fn_param.rs
index cb90e8a3e..c9f0e2473 100644
--- a/crates/ide_completion/src/completions/fn_param.rs
+++ b/crates/ide_completion/src/completions/fn_param.rs
@@ -64,10 +64,10 @@ pub(crate) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
64mod tests { 64mod tests {
65 use expect_test::{expect, Expect}; 65 use expect_test::{expect, Expect};
66 66
67 use crate::{test_utils::completion_list, CompletionKind}; 67 use crate::{tests::filtered_completion_list, CompletionKind};
68 68
69 fn check(ra_fixture: &str, expect: Expect) { 69 fn check(ra_fixture: &str, expect: Expect) {
70 let actual = completion_list(ra_fixture, CompletionKind::Magic); 70 let actual = filtered_completion_list(ra_fixture, CompletionKind::Magic);
71 expect.assert_eq(&actual); 71 expect.assert_eq(&actual);
72 } 72 }
73 73
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs
index 0a3df79d4..73bbc4345 100644
--- a/crates/ide_completion/src/completions/keyword.rs
+++ b/crates/ide_completion/src/completions/keyword.rs
@@ -190,12 +190,12 @@ mod tests {
190 use expect_test::{expect, Expect}; 190 use expect_test::{expect, Expect};
191 191
192 use crate::{ 192 use crate::{
193 test_utils::{check_edit, completion_list}, 193 tests::{check_edit, filtered_completion_list},
194 CompletionKind, 194 CompletionKind,
195 }; 195 };
196 196
197 fn check(ra_fixture: &str, expect: Expect) { 197 fn check(ra_fixture: &str, expect: Expect) {
198 let actual = completion_list(ra_fixture, CompletionKind::Keyword); 198 let actual = filtered_completion_list(ra_fixture, CompletionKind::Keyword);
199 expect.assert_eq(&actual) 199 expect.assert_eq(&actual)
200 } 200 }
201 201
diff --git a/crates/ide_completion/src/completions/lifetime.rs b/crates/ide_completion/src/completions/lifetime.rs
index 8ccccb646..36f595164 100644
--- a/crates/ide_completion/src/completions/lifetime.rs
+++ b/crates/ide_completion/src/completions/lifetime.rs
@@ -50,7 +50,7 @@ mod tests {
50 use expect_test::{expect, Expect}; 50 use expect_test::{expect, Expect};
51 51
52 use crate::{ 52 use crate::{
53 test_utils::{check_edit, completion_list_with_config, TEST_CONFIG}, 53 tests::{check_edit, filtered_completion_list_with_config, TEST_CONFIG},
54 CompletionConfig, CompletionKind, 54 CompletionConfig, CompletionKind,
55 }; 55 };
56 56
@@ -59,7 +59,8 @@ mod tests {
59 } 59 }
60 60
61 fn check_with_config(config: CompletionConfig, ra_fixture: &str, expect: Expect) { 61 fn check_with_config(config: CompletionConfig, ra_fixture: &str, expect: Expect) {
62 let actual = completion_list_with_config(config, ra_fixture, CompletionKind::Reference); 62 let actual =
63 filtered_completion_list_with_config(config, ra_fixture, CompletionKind::Reference);
63 expect.assert_eq(&actual) 64 expect.assert_eq(&actual)
64 } 65 }
65 66
diff --git a/crates/ide_completion/src/completions/mod_.rs b/crates/ide_completion/src/completions/mod_.rs
index 6a5746fb9..5def0d06a 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)]
143mod tests { 143mod tests {
144 use crate::{test_utils::completion_list, CompletionKind}; 144 use crate::{tests::filtered_completion_list, CompletionKind};
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 = completion_list(ra_fixture, CompletionKind::Magic); 148 let actual = filtered_completion_list(ra_fixture, CompletionKind::Magic);
149 expect.assert_eq(&actual); 149 expect.assert_eq(&actual);
150 } 150 }
151 151
diff --git a/crates/ide_completion/src/completions/pattern.rs b/crates/ide_completion/src/completions/pattern.rs
index e45b2a1ea..efe3c957a 100644
--- a/crates/ide_completion/src/completions/pattern.rs
+++ b/crates/ide_completion/src/completions/pattern.rs
@@ -61,17 +61,17 @@ mod tests {
61 use expect_test::{expect, Expect}; 61 use expect_test::{expect, Expect};
62 62
63 use crate::{ 63 use crate::{
64 test_utils::{check_edit, completion_list}, 64 tests::{check_edit, filtered_completion_list},
65 CompletionKind, 65 CompletionKind,
66 }; 66 };
67 67
68 fn check(ra_fixture: &str, expect: Expect) { 68 fn check(ra_fixture: &str, expect: Expect) {
69 let actual = completion_list(ra_fixture, CompletionKind::Reference); 69 let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference);
70 expect.assert_eq(&actual) 70 expect.assert_eq(&actual)
71 } 71 }
72 72
73 fn check_snippet(ra_fixture: &str, expect: Expect) { 73 fn check_snippet(ra_fixture: &str, expect: Expect) {
74 let actual = completion_list(ra_fixture, CompletionKind::Snippet); 74 let actual = filtered_completion_list(ra_fixture, CompletionKind::Snippet);
75 expect.assert_eq(&actual) 75 expect.assert_eq(&actual)
76 } 76 }
77 77
diff --git a/crates/ide_completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs
index 9f98b21be..c3c7e4589 100644
--- a/crates/ide_completion/src/completions/postfix.rs
+++ b/crates/ide_completion/src/completions/postfix.rs
@@ -307,12 +307,12 @@ mod tests {
307 use expect_test::{expect, Expect}; 307 use expect_test::{expect, Expect};
308 308
309 use crate::{ 309 use crate::{
310 test_utils::{check_edit, completion_list}, 310 tests::{check_edit, filtered_completion_list},
311 CompletionKind, 311 CompletionKind,
312 }; 312 };
313 313
314 fn check(ra_fixture: &str, expect: Expect) { 314 fn check(ra_fixture: &str, expect: Expect) {
315 let actual = completion_list(ra_fixture, CompletionKind::Postfix); 315 let actual = filtered_completion_list(ra_fixture, CompletionKind::Postfix);
316 expect.assert_eq(&actual) 316 expect.assert_eq(&actual)
317 } 317 }
318 318
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index 165b9e6a5..9432caa22 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -198,17 +198,17 @@ mod tests {
198 use expect_test::{expect, Expect}; 198 use expect_test::{expect, Expect};
199 199
200 use crate::{ 200 use crate::{
201 test_utils::{check_edit, completion_list}, 201 tests::{check_edit, filtered_completion_list},
202 CompletionKind, 202 CompletionKind,
203 }; 203 };
204 204
205 fn check(ra_fixture: &str, expect: Expect) { 205 fn check(ra_fixture: &str, expect: Expect) {
206 let actual = completion_list(ra_fixture, CompletionKind::Reference); 206 let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference);
207 expect.assert_eq(&actual); 207 expect.assert_eq(&actual);
208 } 208 }
209 209
210 fn check_builtin(ra_fixture: &str, expect: Expect) { 210 fn check_builtin(ra_fixture: &str, expect: Expect) {
211 let actual = completion_list(ra_fixture, CompletionKind::BuiltinType); 211 let actual = filtered_completion_list(ra_fixture, CompletionKind::BuiltinType);
212 expect.assert_eq(&actual); 212 expect.assert_eq(&actual);
213 } 213 }
214 214
diff --git a/crates/ide_completion/src/completions/record.rs b/crates/ide_completion/src/completions/record.rs
index 0ac47cdbe..47523f72f 100644
--- a/crates/ide_completion/src/completions/record.rs
+++ b/crates/ide_completion/src/completions/record.rs
@@ -51,17 +51,17 @@ mod tests {
51 use ide_db::helpers::FamousDefs; 51 use ide_db::helpers::FamousDefs;
52 52
53 use crate::{ 53 use crate::{
54 test_utils::{self, completion_list}, 54 tests::{self, filtered_completion_list},
55 CompletionKind, 55 CompletionKind,
56 }; 56 };
57 57
58 fn check(ra_fixture: &str, expect: Expect) { 58 fn check(ra_fixture: &str, expect: Expect) {
59 let actual = completion_list(ra_fixture, CompletionKind::Reference); 59 let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference);
60 expect.assert_eq(&actual); 60 expect.assert_eq(&actual);
61 } 61 }
62 62
63 fn check_snippet(ra_fixture: &str, expect: Expect) { 63 fn check_snippet(ra_fixture: &str, expect: Expect) {
64 let actual = completion_list( 64 let actual = filtered_completion_list(
65 &format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE), 65 &format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE),
66 CompletionKind::Snippet, 66 CompletionKind::Snippet,
67 ); 67 );
@@ -69,7 +69,7 @@ mod tests {
69 } 69 }
70 70
71 fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) { 71 fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
72 test_utils::check_edit( 72 tests::check_edit(
73 what, 73 what,
74 &format!( 74 &format!(
75 "//- /main.rs crate:main deps:core{}\n{}", 75 "//- /main.rs crate:main deps:core{}\n{}",
diff --git a/crates/ide_completion/src/completions/snippet.rs b/crates/ide_completion/src/completions/snippet.rs
index d142265e0..81ddfa34f 100644
--- a/crates/ide_completion/src/completions/snippet.rs
+++ b/crates/ide_completion/src/completions/snippet.rs
@@ -87,10 +87,10 @@ fn ${1:feature}() {
87mod tests { 87mod tests {
88 use expect_test::{expect, Expect}; 88 use expect_test::{expect, Expect};
89 89
90 use crate::{test_utils::completion_list, CompletionKind}; 90 use crate::{tests::filtered_completion_list, CompletionKind};
91 91
92 fn check(ra_fixture: &str, expect: Expect) { 92 fn check(ra_fixture: &str, expect: Expect) {
93 let actual = completion_list(ra_fixture, CompletionKind::Snippet); 93 let actual = filtered_completion_list(ra_fixture, CompletionKind::Snippet);
94 expect.assert_eq(&actual) 94 expect.assert_eq(&actual)
95 } 95 }
96 96
diff --git a/crates/ide_completion/src/completions/trait_impl.rs b/crates/ide_completion/src/completions/trait_impl.rs
index a60e5f43c..dc1d198cc 100644
--- a/crates/ide_completion/src/completions/trait_impl.rs
+++ b/crates/ide_completion/src/completions/trait_impl.rs
@@ -246,12 +246,12 @@ mod tests {
246 use expect_test::{expect, Expect}; 246 use expect_test::{expect, Expect};
247 247
248 use crate::{ 248 use crate::{
249 test_utils::{check_edit, completion_list}, 249 tests::{check_edit, filtered_completion_list},
250 CompletionKind, 250 CompletionKind,
251 }; 251 };
252 252
253 fn check(ra_fixture: &str, expect: Expect) { 253 fn check(ra_fixture: &str, expect: Expect) {
254 let actual = completion_list(ra_fixture, CompletionKind::Magic); 254 let actual = filtered_completion_list(ra_fixture, CompletionKind::Magic);
255 expect.assert_eq(&actual) 255 expect.assert_eq(&actual)
256 } 256 }
257 257
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index 3910de2c4..2868d9b18 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -93,7 +93,7 @@ mod tests {
93 use expect_test::{expect, Expect}; 93 use expect_test::{expect, Expect};
94 94
95 use crate::{ 95 use crate::{
96 test_utils::{check_edit, completion_list_with_config, TEST_CONFIG}, 96 tests::{check_edit, filtered_completion_list_with_config, TEST_CONFIG},
97 CompletionConfig, CompletionKind, 97 CompletionConfig, CompletionKind,
98 }; 98 };
99 99
@@ -102,7 +102,8 @@ mod tests {
102 } 102 }
103 103
104 fn check_with_config(config: CompletionConfig, ra_fixture: &str, expect: Expect) { 104 fn check_with_config(config: CompletionConfig, ra_fixture: &str, expect: Expect) {
105 let actual = completion_list_with_config(config, ra_fixture, CompletionKind::Reference); 105 let actual =
106 filtered_completion_list_with_config(config, ra_fixture, CompletionKind::Reference);
106 expect.assert_eq(&actual) 107 expect.assert_eq(&actual)
107 } 108 }
108 109