aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion/presentation.rs
diff options
context:
space:
mode:
authorYuki Kodama <[email protected]>2020-05-24 15:01:26 +0100
committerYuki Kodama <[email protected]>2020-05-25 17:06:25 +0100
commit378bfc3c8f1c63f44f972e11c9de00f9733b13c0 (patch)
treef1c7782e811d0515ffae733fb71eb4f00feec255 /crates/ra_ide/src/completion/presentation.rs
parent4d13691ad192c20b2fb0f349582622cb5230da99 (diff)
Separate assertions
Diffstat (limited to 'crates/ra_ide/src/completion/presentation.rs')
-rw-r--r--crates/ra_ide/src/completion/presentation.rs72
1 files changed, 65 insertions, 7 deletions
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index 6b29f58d5..5708ff291 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -641,7 +641,7 @@ mod tests {
641 assert_debug_snapshot!( 641 assert_debug_snapshot!(
642 do_reference_completion( 642 do_reference_completion(
643 r" 643 r"
644 fn with_args(x: i32, y: String, _z: bool) {} 644 fn with_args(x: i32, y: String) {}
645 fn main() { with_<|> } 645 fn main() { with_<|> }
646 " 646 "
647 ), 647 ),
@@ -649,8 +649,8 @@ mod tests {
649 [ 649 [
650 CompletionItem { 650 CompletionItem {
651 label: "main()", 651 label: "main()",
652 source_range: 90..95, 652 source_range: 80..85,
653 delete: 90..95, 653 delete: 80..85,
654 insert: "main()$0", 654 insert: "main()$0",
655 kind: Function, 655 kind: Function,
656 lookup: "main", 656 lookup: "main",
@@ -658,12 +658,43 @@ mod tests {
658 }, 658 },
659 CompletionItem { 659 CompletionItem {
660 label: "with_args(…)", 660 label: "with_args(…)",
661 source_range: 90..95, 661 source_range: 80..85,
662 delete: 90..95, 662 delete: 80..85,
663 insert: "with_args(${1:x}, ${2:y}, ${3:z})$0", 663 insert: "with_args(${1:x}, ${2:y})$0",
664 kind: Function, 664 kind: Function,
665 lookup: "with_args", 665 lookup: "with_args",
666 detail: "fn with_args(x: i32, y: String, _z: bool)", 666 detail: "fn with_args(x: i32, y: String)",
667 trigger_call_info: true,
668 },
669 ]
670 "###
671 );
672 assert_debug_snapshot!(
673 do_reference_completion(
674 r"
675 fn with_ignored_args(_foo: i32, b_a_r_: bool) {}
676 fn main() { with_<|> }
677 "
678 ),
679 @r###"
680 [
681 CompletionItem {
682 label: "main()",
683 source_range: 94..99,
684 delete: 94..99,
685 insert: "main()$0",
686 kind: Function,
687 lookup: "main",
688 detail: "fn main()",
689 },
690 CompletionItem {
691 label: "with_ignored_args(…)",
692 source_range: 94..99,
693 delete: 94..99,
694 insert: "with_ignored_args(${1:foo}, ${2:b_a_r_})$0",
695 kind: Function,
696 lookup: "with_ignored_args",
697 detail: "fn with_ignored_args(_foo: i32, b_a_r_: bool)",
667 trigger_call_info: true, 698 trigger_call_info: true,
668 }, 699 },
669 ] 700 ]
@@ -695,6 +726,33 @@ mod tests {
695 ] 726 ]
696 "### 727 "###
697 ); 728 );
729 assert_debug_snapshot!(
730 do_reference_completion(
731 r"
732 struct S {}
733 impl S {
734 fn foo_ignored_args(&self, _a: bool, b: i32) {}
735 }
736 fn bar(s: &S) {
737 s.f<|>
738 }
739 "
740 ),
741 @r###"
742 [
743 CompletionItem {
744 label: "foo_ignored_args(…)",
745 source_range: 194..195,
746 delete: 194..195,
747 insert: "foo_ignored_args(${1:a}, ${2:b})$0",
748 kind: Method,
749 lookup: "foo_ignored_args",
750 detail: "fn foo_ignored_args(&self, _a: bool, b: i32)",
751 trigger_call_info: true,
752 },
753 ]
754 "###
755 );
698 } 756 }
699 757
700 #[test] 758 #[test]