diff options
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index a58fdc036..b471787eb 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -559,6 +559,66 @@ mod tests { | |||
559 | } | 559 | } |
560 | 560 | ||
561 | #[test] | 561 | #[test] |
562 | fn completes_trait_associated_method_1() { | ||
563 | assert_debug_snapshot!( | ||
564 | do_reference_completion( | ||
565 | " | ||
566 | //- /lib.rs | ||
567 | trait Trait { | ||
568 | /// A trait method | ||
569 | fn m(); | ||
570 | } | ||
571 | |||
572 | fn foo() { let _ = Trait::<|> } | ||
573 | " | ||
574 | ), | ||
575 | @"[]" | ||
576 | ); | ||
577 | } | ||
578 | |||
579 | #[test] | ||
580 | fn completes_trait_associated_method_2() { | ||
581 | assert_debug_snapshot!( | ||
582 | do_reference_completion( | ||
583 | " | ||
584 | //- /lib.rs | ||
585 | trait Trait { | ||
586 | /// A trait method | ||
587 | fn m(); | ||
588 | } | ||
589 | |||
590 | struct S; | ||
591 | impl Trait for S {} | ||
592 | |||
593 | fn foo() { let _ = S::<|> } | ||
594 | " | ||
595 | ), | ||
596 | @"[]" | ||
597 | ); | ||
598 | } | ||
599 | |||
600 | #[test] | ||
601 | fn completes_trait_associated_method_3() { | ||
602 | assert_debug_snapshot!( | ||
603 | do_reference_completion( | ||
604 | " | ||
605 | //- /lib.rs | ||
606 | trait Trait { | ||
607 | /// A trait method | ||
608 | fn m(); | ||
609 | } | ||
610 | |||
611 | struct S; | ||
612 | impl Trait for S {} | ||
613 | |||
614 | fn foo() { let _ = <S as Trait>::<|> } | ||
615 | " | ||
616 | ), | ||
617 | @"[]" | ||
618 | ); | ||
619 | } | ||
620 | |||
621 | #[test] | ||
562 | fn completes_type_alias() { | 622 | fn completes_type_alias() { |
563 | assert_debug_snapshot!( | 623 | assert_debug_snapshot!( |
564 | do_reference_completion( | 624 | do_reference_completion( |