File tree Expand file tree Collapse file tree 1 file changed +73
-0
lines changed
crates/ide-completion/src/tests Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ fn foo(a$0: Tuple) {
198
198
st Unit
199
199
bn Record {…} Record { field$1 }$0
200
200
bn Tuple(…) Tuple($1)$0
201
+ bn tuple
201
202
kw mut
202
203
kw ref
203
204
"# ] ] ,
@@ -850,3 +851,75 @@ fn foo() {
850
851
"# ,
851
852
) ;
852
853
}
854
+
855
+ #[ test]
856
+ fn suggest_name_for_pattern ( ) {
857
+ check_edit (
858
+ "s1" ,
859
+ r#"
860
+ struct S1;
861
+
862
+ fn foo() {
863
+ let $0 = S1;
864
+ }
865
+ "# ,
866
+ r#"
867
+ struct S1;
868
+
869
+ fn foo() {
870
+ let s1 = S1;
871
+ }
872
+ "# ,
873
+ ) ;
874
+
875
+ check_edit (
876
+ "s1" ,
877
+ r#"
878
+ struct S1;
879
+
880
+ fn foo(s$0: S1) {
881
+ }
882
+ "# ,
883
+ r#"
884
+ struct S1;
885
+
886
+ fn foo(s1: S1) {
887
+ }
888
+ "# ,
889
+ ) ;
890
+
891
+ // Tests for &adt
892
+ check_edit (
893
+ "s1" ,
894
+ r#"
895
+ struct S1;
896
+
897
+ fn foo() {
898
+ let $0 = &S1;
899
+ }
900
+ "# ,
901
+ r#"
902
+ struct S1;
903
+
904
+ fn foo() {
905
+ let s1 = &S1;
906
+ }
907
+ "# ,
908
+ ) ;
909
+
910
+ // Do not suggest reserved keywords
911
+ check_empty (
912
+ r#"
913
+ struct Struct;
914
+
915
+ fn foo() {
916
+ let $0 = Struct;
917
+ }
918
+ "# ,
919
+ expect ! [ [ r#"
920
+ st Struct
921
+ kw mut
922
+ kw ref
923
+ "# ] ] ,
924
+ ) ;
925
+ }
You can’t perform that action at this time.
0 commit comments