diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_item.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index 95bdd59b4..91e32b3c8 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -411,83 +411,3 @@ pub(crate) fn check_completion(test_name: &str, code: &str, kind: CompletionKind | |||
411 | let kind_completions = do_completion(code, kind); | 411 | let kind_completions = do_completion(code, kind); |
412 | assert_debug_snapshot_matches!(test_name, kind_completions); | 412 | assert_debug_snapshot_matches!(test_name, kind_completions); |
413 | } | 413 | } |
414 | |||
415 | #[cfg(test)] | ||
416 | mod tests { | ||
417 | use test_utils::covers; | ||
418 | |||
419 | use super::*; | ||
420 | |||
421 | fn check_reference_completion(code: &str, expected_completions: &str) { | ||
422 | check_completion(code, expected_completions, CompletionKind::Reference); | ||
423 | } | ||
424 | |||
425 | #[test] | ||
426 | fn inserts_parens_for_function_calls() { | ||
427 | covers!(inserts_parens_for_function_calls); | ||
428 | check_reference_completion( | ||
429 | "inserts_parens_for_function_calls1", | ||
430 | r" | ||
431 | fn no_args() {} | ||
432 | fn main() { no_<|> } | ||
433 | ", | ||
434 | ); | ||
435 | check_reference_completion( | ||
436 | "inserts_parens_for_function_calls2", | ||
437 | r" | ||
438 | fn with_args(x: i32, y: String) {} | ||
439 | fn main() { with_<|> } | ||
440 | ", | ||
441 | ); | ||
442 | check_reference_completion( | ||
443 | "inserts_parens_for_function_calls3", | ||
444 | r" | ||
445 | struct S {} | ||
446 | impl S { | ||
447 | fn foo(&self) {} | ||
448 | } | ||
449 | fn bar(s: &S) { | ||
450 | s.f<|> | ||
451 | } | ||
452 | ", | ||
453 | ) | ||
454 | } | ||
455 | |||
456 | #[test] | ||
457 | fn dont_render_function_parens_in_use_item() { | ||
458 | check_reference_completion( | ||
459 | "dont_render_function_parens_in_use_item", | ||
460 | " | ||
461 | //- /lib.rs | ||
462 | mod m { pub fn foo() {} } | ||
463 | use crate::m::f<|>; | ||
464 | ", | ||
465 | ) | ||
466 | } | ||
467 | |||
468 | #[test] | ||
469 | fn dont_render_function_parens_if_already_call() { | ||
470 | check_reference_completion( | ||
471 | "dont_render_function_parens_if_already_call", | ||
472 | " | ||
473 | //- /lib.rs | ||
474 | fn frobnicate() {} | ||
475 | fn main() { | ||
476 | frob<|>(); | ||
477 | } | ||
478 | ", | ||
479 | ); | ||
480 | check_reference_completion( | ||
481 | "dont_render_function_parens_if_already_call_assoc_fn", | ||
482 | " | ||
483 | //- /lib.rs | ||
484 | struct Foo {} | ||
485 | impl Foo { fn new() -> Foo {} } | ||
486 | fn main() { | ||
487 | Foo::ne<|>(); | ||
488 | } | ||
489 | ", | ||
490 | ) | ||
491 | } | ||
492 | |||
493 | } | ||