diff options
Diffstat (limited to 'crates/libsyntax2/tests/data')
5 files changed, 196 insertions, 10 deletions
diff --git a/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt b/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt index c6ae68103..64aa07801 100644 --- a/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt +++ b/crates/libsyntax2/tests/data/parser/err/0004_use_path_bad_segment.txt | |||
@@ -1,20 +1,16 @@ | |||
1 | FILE@[0; 12) | 1 | FILE@[0; 12) |
2 | USE_ITEM@[0; 9) | 2 | USE_ITEM@[0; 12) |
3 | USE_KW@[0; 3) | 3 | USE_KW@[0; 3) |
4 | WHITESPACE@[3; 4) | 4 | WHITESPACE@[3; 4) |
5 | USE_TREE@[4; 9) | 5 | USE_TREE@[4; 11) |
6 | PATH@[4; 9) | 6 | PATH@[4; 11) |
7 | PATH@[4; 7) | 7 | PATH@[4; 7) |
8 | PATH_SEGMENT@[4; 7) | 8 | PATH_SEGMENT@[4; 7) |
9 | NAME_REF@[4; 7) | 9 | NAME_REF@[4; 7) |
10 | IDENT@[4; 7) "foo" | 10 | IDENT@[4; 7) "foo" |
11 | COLONCOLON@[7; 9) | 11 | COLONCOLON@[7; 9) |
12 | err: `expected identifier` | 12 | err: `expected identifier` |
13 | err: `expected SEMI` | 13 | PATH_SEGMENT@[9; 11) |
14 | err: `expected an item` | 14 | ERROR@[9; 11) |
15 | PATH_SEGMENT@[9; 9) | 15 | INT_NUMBER@[9; 11) "92" |
16 | ERROR@[9; 11) | ||
17 | INT_NUMBER@[9; 11) "92" | ||
18 | err: `expected an item` | ||
19 | ERROR@[11; 12) | ||
20 | SEMI@[11; 12) | 16 | SEMI@[11; 12) |
diff --git a/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.rs b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.rs new file mode 100644 index 000000000..75c1d2f98 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.rs | |||
@@ -0,0 +1 @@ | |||
fn foo<T>() where T {} | |||
diff --git a/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.txt b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.txt new file mode 100644 index 000000000..61444a88d --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0014_where_no_bounds.txt | |||
@@ -0,0 +1,31 @@ | |||
1 | FILE@[0; 23) | ||
2 | FUNCTION@[0; 22) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | TYPE_PARAM_LIST@[6; 9) | ||
8 | L_ANGLE@[6; 7) | ||
9 | TYPE_PARAM@[7; 8) | ||
10 | NAME@[7; 8) | ||
11 | IDENT@[7; 8) "T" | ||
12 | R_ANGLE@[8; 9) | ||
13 | PARAM_LIST@[9; 11) | ||
14 | L_PAREN@[9; 10) | ||
15 | R_PAREN@[10; 11) | ||
16 | WHITESPACE@[11; 12) | ||
17 | WHERE_CLAUSE@[12; 19) | ||
18 | WHERE_KW@[12; 17) | ||
19 | WHITESPACE@[17; 18) | ||
20 | WHERE_PRED@[18; 19) | ||
21 | PATH_TYPE@[18; 19) | ||
22 | PATH@[18; 19) | ||
23 | PATH_SEGMENT@[18; 19) | ||
24 | NAME_REF@[18; 19) | ||
25 | IDENT@[18; 19) "T" | ||
26 | err: `expected colon` | ||
27 | WHITESPACE@[19; 20) | ||
28 | BLOCK_EXPR@[20; 22) | ||
29 | L_CURLY@[20; 21) | ||
30 | R_CURLY@[21; 22) | ||
31 | WHITESPACE@[22; 23) | ||
diff --git a/crates/libsyntax2/tests/data/parser/ok/0030_traits.rs b/crates/libsyntax2/tests/data/parser/ok/0030_traits.rs new file mode 100644 index 000000000..23c4be0e1 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/ok/0030_traits.rs | |||
@@ -0,0 +1,11 @@ | |||
1 | pub trait WriteMessage { | ||
2 | fn write_message(&FrontendMessage); | ||
3 | } | ||
4 | |||
5 | trait Runnable { | ||
6 | fn handler(); | ||
7 | } | ||
8 | |||
9 | trait TraitWithExpr { | ||
10 | fn fn_with_expr(x: [i32; 1]); | ||
11 | } | ||
diff --git a/crates/libsyntax2/tests/data/parser/ok/0030_traits.txt b/crates/libsyntax2/tests/data/parser/ok/0030_traits.txt new file mode 100644 index 000000000..8abcb01e0 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/ok/0030_traits.txt | |||
@@ -0,0 +1,147 @@ | |||
1 | FILE@[0; 164) | ||
2 | TRAIT@[0; 164) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) | ||
5 | WHITESPACE@[3; 4) | ||
6 | TRAIT_KW@[4; 9) | ||
7 | WHITESPACE@[9; 10) | ||
8 | NAME@[10; 22) | ||
9 | IDENT@[10; 22) "WriteMessage" | ||
10 | WHITESPACE@[22; 23) | ||
11 | L_CURLY@[23; 24) | ||
12 | WHITESPACE@[24; 29) | ||
13 | FUNCTION@[29; 164) | ||
14 | FN_KW@[29; 31) | ||
15 | WHITESPACE@[31; 32) | ||
16 | NAME@[32; 45) | ||
17 | IDENT@[32; 45) "write_message" | ||
18 | PARAM_LIST@[45; 164) | ||
19 | L_PAREN@[45; 46) | ||
20 | PARAM@[46; 63) | ||
21 | REF_PAT@[46; 62) | ||
22 | AMP@[46; 47) | ||
23 | BIND_PAT@[47; 62) | ||
24 | NAME@[47; 62) | ||
25 | IDENT@[47; 62) "FrontendMessage" | ||
26 | err: `expected COLON` | ||
27 | err: `expected type` | ||
28 | ERROR@[62; 63) | ||
29 | R_PAREN@[62; 63) | ||
30 | err: `expected COMMA` | ||
31 | err: `expected pattern` | ||
32 | PARAM@[63; 66) | ||
33 | ERROR@[63; 64) | ||
34 | SEMI@[63; 64) | ||
35 | err: `expected COLON` | ||
36 | WHITESPACE@[64; 65) | ||
37 | err: `expected type` | ||
38 | ERROR@[65; 66) | ||
39 | R_CURLY@[65; 66) | ||
40 | err: `expected COMMA` | ||
41 | WHITESPACE@[66; 68) | ||
42 | err: `expected pattern` | ||
43 | PARAM@[68; 82) | ||
44 | ERROR@[68; 73) | ||
45 | TRAIT_KW@[68; 73) | ||
46 | err: `expected COLON` | ||
47 | WHITESPACE@[73; 74) | ||
48 | PATH_TYPE@[74; 82) | ||
49 | PATH@[74; 82) | ||
50 | PATH_SEGMENT@[74; 82) | ||
51 | NAME_REF@[74; 82) | ||
52 | IDENT@[74; 82) "Runnable" | ||
53 | err: `expected COMMA` | ||
54 | WHITESPACE@[82; 83) | ||
55 | err: `expected pattern` | ||
56 | PARAM@[83; 91) | ||
57 | ERROR@[83; 84) | ||
58 | L_CURLY@[83; 84) | ||
59 | err: `expected COLON` | ||
60 | WHITESPACE@[84; 89) | ||
61 | FN_POINTER_TYPE@[89; 91) | ||
62 | FN_KW@[89; 91) | ||
63 | err: `expected parameters` | ||
64 | err: `expected COMMA` | ||
65 | WHITESPACE@[91; 92) | ||
66 | PARAM@[92; 102) | ||
67 | TUPLE_STRUCT_PAT@[92; 101) | ||
68 | PATH@[92; 99) | ||
69 | PATH_SEGMENT@[92; 99) | ||
70 | NAME_REF@[92; 99) | ||
71 | IDENT@[92; 99) "handler" | ||
72 | L_PAREN@[99; 100) | ||
73 | R_PAREN@[100; 101) | ||
74 | err: `expected COLON` | ||
75 | err: `expected type` | ||
76 | ERROR@[101; 102) | ||
77 | SEMI@[101; 102) | ||
78 | err: `expected COMMA` | ||
79 | WHITESPACE@[102; 103) | ||
80 | err: `expected pattern` | ||
81 | PARAM@[103; 111) | ||
82 | ERROR@[103; 104) | ||
83 | R_CURLY@[103; 104) | ||
84 | err: `expected COLON` | ||
85 | WHITESPACE@[104; 106) | ||
86 | err: `expected type` | ||
87 | ERROR@[106; 111) | ||
88 | TRAIT_KW@[106; 111) | ||
89 | err: `expected COMMA` | ||
90 | WHITESPACE@[111; 112) | ||
91 | PARAM@[112; 164) | ||
92 | STRUCT_PAT@[112; 163) | ||
93 | PATH@[112; 125) | ||
94 | PATH_SEGMENT@[112; 125) | ||
95 | NAME_REF@[112; 125) | ||
96 | IDENT@[112; 125) "TraitWithExpr" | ||
97 | WHITESPACE@[125; 126) | ||
98 | L_CURLY@[126; 127) | ||
99 | WHITESPACE@[127; 132) | ||
100 | err: `expected ident` | ||
101 | ERROR@[132; 134) | ||
102 | FN_KW@[132; 134) | ||
103 | err: `expected COMMA` | ||
104 | WHITESPACE@[134; 135) | ||
105 | BIND_PAT@[135; 147) | ||
106 | NAME@[135; 147) | ||
107 | IDENT@[135; 147) "fn_with_expr" | ||
108 | err: `expected COMMA` | ||
109 | err: `expected ident` | ||
110 | ERROR@[147; 148) | ||
111 | L_PAREN@[147; 148) | ||
112 | err: `expected COMMA` | ||
113 | IDENT@[148; 149) "x" | ||
114 | COLON@[149; 150) | ||
115 | WHITESPACE@[150; 151) | ||
116 | SLICE_PAT@[151; 159) | ||
117 | L_BRACK@[151; 152) | ||
118 | BIND_PAT@[152; 155) | ||
119 | NAME@[152; 155) | ||
120 | IDENT@[152; 155) "i32" | ||
121 | err: `expected COMMA` | ||
122 | err: `expected pattern` | ||
123 | ERROR@[155; 156) | ||
124 | SEMI@[155; 156) | ||
125 | err: `expected COMMA` | ||
126 | WHITESPACE@[156; 157) | ||
127 | LITERAL@[157; 158) | ||
128 | INT_NUMBER@[157; 158) "1" | ||
129 | R_BRACK@[158; 159) | ||
130 | err: `expected COMMA` | ||
131 | err: `expected ident` | ||
132 | ERROR@[159; 160) | ||
133 | R_PAREN@[159; 160) | ||
134 | err: `expected COMMA` | ||
135 | err: `expected ident` | ||
136 | ERROR@[160; 161) | ||
137 | SEMI@[160; 161) | ||
138 | WHITESPACE@[161; 162) | ||
139 | R_CURLY@[162; 163) | ||
140 | err: `expected COLON` | ||
141 | WHITESPACE@[163; 164) | ||
142 | err: `expected type` | ||
143 | err: `expected COMMA` | ||
144 | err: `expected R_PAREN` | ||
145 | err: `expected block` | ||
146 | err: `expected R_CURLY` | ||
147 | ERROR@[164; 164) | ||