aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-22 16:05:28 +0000
committerAleksey Kladov <[email protected]>2021-01-22 16:15:34 +0000
commit96197e08730a74bb8d5c724968c99d22aa0ca17a (patch)
tree36ded65537cecddefb5ef91962e9770243d44f4b /crates/completion/src
parenta40f78f92ad2050d6178dfd70374701c6bc826ae (diff)
Normalize tests
Diffstat (limited to 'crates/completion/src')
-rw-r--r--crates/completion/src/lib.rs82
1 files changed, 37 insertions, 45 deletions
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs
index 50329b499..db8bfbbc3 100644
--- a/crates/completion/src/lib.rs
+++ b/crates/completion/src/lib.rs
@@ -209,24 +209,23 @@ mod tests {
209 fn test_completion_detail_from_macro_generated_struct_fn_doc_attr() { 209 fn test_completion_detail_from_macro_generated_struct_fn_doc_attr() {
210 check_detail_and_documentation( 210 check_detail_and_documentation(
211 r#" 211 r#"
212 //- /lib.rs 212macro_rules! bar {
213 macro_rules! bar { 213 () => {
214 () => { 214 struct Bar;
215 struct Bar; 215 impl Bar {
216 impl Bar { 216 #[doc = "Do the foo"]
217 #[doc = "Do the foo"] 217 fn foo(&self) {}
218 fn foo(&self) {} 218 }
219 } 219 }
220 } 220}
221 }
222 221
223 bar!(); 222bar!();
224 223
225 fn foo() { 224fn foo() {
226 let bar = Bar; 225 let bar = Bar;
227 bar.fo$0; 226 bar.fo$0;
228 } 227}
229 "#, 228"#,
230 DetailAndDocumentation { detail: "-> ()", documentation: "Do the foo" }, 229 DetailAndDocumentation { detail: "-> ()", documentation: "Do the foo" },
231 ); 230 );
232 } 231 }
@@ -235,24 +234,23 @@ mod tests {
235 fn test_completion_detail_from_macro_generated_struct_fn_doc_comment() { 234 fn test_completion_detail_from_macro_generated_struct_fn_doc_comment() {
236 check_detail_and_documentation( 235 check_detail_and_documentation(
237 r#" 236 r#"
238 //- /lib.rs 237macro_rules! bar {
239 macro_rules! bar { 238 () => {
240 () => { 239 struct Bar;
241 struct Bar; 240 impl Bar {
242 impl Bar { 241 /// Do the foo
243 /// Do the foo 242 fn foo(&self) {}
244 fn foo(&self) {} 243 }
245 } 244 }
246 } 245}
247 }
248 246
249 bar!(); 247bar!();
250 248
251 fn foo() { 249fn foo() {
252 let bar = Bar; 250 let bar = Bar;
253 bar.fo$0; 251 bar.fo$0;
254 } 252}
255 "#, 253"#,
256 DetailAndDocumentation { detail: "-> ()", documentation: " Do the foo" }, 254 DetailAndDocumentation { detail: "-> ()", documentation: " Do the foo" },
257 ); 255 );
258 } 256 }
@@ -260,23 +258,17 @@ mod tests {
260 #[test] 258 #[test]
261 fn test_no_completions_required() { 259 fn test_no_completions_required() {
262 // There must be no hint for 'in' keyword. 260 // There must be no hint for 'in' keyword.
263 check_no_completion( 261 check_no_completion(r#"fn foo() { for i i$0 }"#);
264 r#"
265 fn foo() {
266 for i i$0
267 }
268 "#,
269 );
270 // After 'in' keyword hints may be spawned. 262 // After 'in' keyword hints may be spawned.
271 check_detail_and_documentation( 263 check_detail_and_documentation(
272 r#" 264 r#"
273 /// Do the foo 265/// Do the foo
274 fn foo() -> &'static str { "foo" } 266fn foo() -> &'static str { "foo" }
275 267
276 fn bar() { 268fn bar() {
277 for c in fo$0 269 for c in fo$0
278 } 270}
279 "#, 271"#,
280 DetailAndDocumentation { detail: "-> &str", documentation: "Do the foo" }, 272 DetailAndDocumentation { detail: "-> &str", documentation: "Do the foo" },
281 ); 273 );
282 } 274 }