diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/lexer/0011_keywords.rs | 2 | ||||
-rw-r--r-- | tests/data/lexer/0011_keywords.txt | 10 | ||||
-rw-r--r-- | tests/data/parser/err/0001_item_recovery_in_file.txt | 4 | ||||
-rw-r--r-- | tests/data/parser/err/0008_item_block_recovery.txt | 2 | ||||
-rw-r--r-- | tests/data/parser/ok/0020_type_param_bounds.rs | 9 | ||||
-rw-r--r-- | tests/data/parser/ok/0020_type_param_bounds.txt | 169 |
6 files changed, 192 insertions, 4 deletions
diff --git a/tests/data/lexer/0011_keywords.rs b/tests/data/lexer/0011_keywords.rs index c2c9e5667..02ca19089 100644 --- a/tests/data/lexer/0011_keywords.rs +++ b/tests/data/lexer/0011_keywords.rs | |||
@@ -1 +1 @@ | |||
fn use struct trait enum impl true false as extern crate mod pub self super in where | fn use struct trait enum impl true false as extern crate mod pub self super in where for loop while if match | ||
diff --git a/tests/data/lexer/0011_keywords.txt b/tests/data/lexer/0011_keywords.txt index 301ee21e2..964e3475a 100644 --- a/tests/data/lexer/0011_keywords.txt +++ b/tests/data/lexer/0011_keywords.txt | |||
@@ -31,4 +31,14 @@ WHITESPACE 1 " " | |||
31 | IN_KW 2 "in" | 31 | IN_KW 2 "in" |
32 | WHITESPACE 1 " " | 32 | WHITESPACE 1 " " |
33 | WHERE_KW 5 "where" | 33 | WHERE_KW 5 "where" |
34 | WHITESPACE 1 " " | ||
35 | FOR_KW 3 "for" | ||
36 | WHITESPACE 1 " " | ||
37 | LOOP_KW 4 "loop" | ||
38 | WHITESPACE 1 " " | ||
39 | WHILE_KW 5 "while" | ||
40 | WHITESPACE 1 " " | ||
41 | IF_KW 2 "if" | ||
42 | WHITESPACE 1 " " | ||
43 | MATCH_KW 5 "match" | ||
34 | WHITESPACE 1 "\n" | 44 | WHITESPACE 1 "\n" |
diff --git a/tests/data/parser/err/0001_item_recovery_in_file.txt b/tests/data/parser/err/0001_item_recovery_in_file.txt index ac0760695..c33113c6d 100644 --- a/tests/data/parser/err/0001_item_recovery_in_file.txt +++ b/tests/data/parser/err/0001_item_recovery_in_file.txt | |||
@@ -1,11 +1,11 @@ | |||
1 | FILE@[0; 21) | 1 | FILE@[0; 21) |
2 | ERROR@[0; 3) | 2 | ERROR@[0; 3) |
3 | err: `expected item` | 3 | err: `expected item` |
4 | IDENT@[0; 2) "if" | 4 | IF_KW@[0; 2) |
5 | WHITESPACE@[2; 3) | 5 | WHITESPACE@[2; 3) |
6 | ERROR@[3; 10) | 6 | ERROR@[3; 10) |
7 | err: `expected item` | 7 | err: `expected item` |
8 | IDENT@[3; 8) "match" | 8 | MATCH_KW@[3; 8) |
9 | WHITESPACE@[8; 10) | 9 | WHITESPACE@[8; 10) |
10 | STRUCT_ITEM@[10; 21) | 10 | STRUCT_ITEM@[10; 21) |
11 | STRUCT_KW@[10; 16) | 11 | STRUCT_KW@[10; 16) |
diff --git a/tests/data/parser/err/0008_item_block_recovery.txt b/tests/data/parser/err/0008_item_block_recovery.txt index df6a952cd..c6386fd73 100644 --- a/tests/data/parser/err/0008_item_block_recovery.txt +++ b/tests/data/parser/err/0008_item_block_recovery.txt | |||
@@ -24,7 +24,7 @@ FILE@[0; 95) | |||
24 | err: `expected item` | 24 | err: `expected item` |
25 | L_CURLY@[20; 21) | 25 | L_CURLY@[20; 21) |
26 | WHITESPACE@[21; 26) | 26 | WHITESPACE@[21; 26) |
27 | IDENT@[26; 28) "if" | 27 | IF_KW@[26; 28) |
28 | WHITESPACE@[28; 29) | 28 | WHITESPACE@[28; 29) |
29 | TRUE_KW@[29; 33) | 29 | TRUE_KW@[29; 33) |
30 | WHITESPACE@[33; 34) | 30 | WHITESPACE@[33; 34) |
diff --git a/tests/data/parser/ok/0020_type_param_bounds.rs b/tests/data/parser/ok/0020_type_param_bounds.rs new file mode 100644 index 000000000..a1b9f00a4 --- /dev/null +++ b/tests/data/parser/ok/0020_type_param_bounds.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | struct A<T>; | ||
2 | struct B<T:>; | ||
3 | struct C<T: 'a>; | ||
4 | struct D<T: 'a + >; | ||
5 | struct E<T: 'a + 'd >; | ||
6 | struct F<T: 'a + 'd + Clone>; | ||
7 | struct G<T: Clone + Copy>; | ||
8 | struct H<T: ::Foo + self::Bar + 'a>; | ||
9 | struct I<T:, U:,>; | ||
diff --git a/tests/data/parser/ok/0020_type_param_bounds.txt b/tests/data/parser/ok/0020_type_param_bounds.txt new file mode 100644 index 000000000..6f65d150a --- /dev/null +++ b/tests/data/parser/ok/0020_type_param_bounds.txt | |||
@@ -0,0 +1,169 @@ | |||
1 | FILE@[0; 200) | ||
2 | STRUCT_ITEM@[0; 13) | ||
3 | STRUCT_KW@[0; 6) | ||
4 | WHITESPACE@[6; 7) | ||
5 | IDENT@[7; 8) "A" | ||
6 | TYPE_PARAM_LIST@[8; 11) | ||
7 | L_ANGLE@[8; 9) | ||
8 | TYPE_PARAM@[9; 10) | ||
9 | IDENT@[9; 10) "T" | ||
10 | R_ANGLE@[10; 11) | ||
11 | SEMI@[11; 12) | ||
12 | WHITESPACE@[12; 13) | ||
13 | STRUCT_ITEM@[13; 27) | ||
14 | STRUCT_KW@[13; 19) | ||
15 | WHITESPACE@[19; 20) | ||
16 | IDENT@[20; 21) "B" | ||
17 | TYPE_PARAM_LIST@[21; 25) | ||
18 | L_ANGLE@[21; 22) | ||
19 | TYPE_PARAM@[22; 24) | ||
20 | IDENT@[22; 23) "T" | ||
21 | COLON@[23; 24) | ||
22 | R_ANGLE@[24; 25) | ||
23 | SEMI@[25; 26) | ||
24 | WHITESPACE@[26; 27) | ||
25 | STRUCT_ITEM@[27; 44) | ||
26 | STRUCT_KW@[27; 33) | ||
27 | WHITESPACE@[33; 34) | ||
28 | IDENT@[34; 35) "C" | ||
29 | TYPE_PARAM_LIST@[35; 42) | ||
30 | L_ANGLE@[35; 36) | ||
31 | TYPE_PARAM@[36; 41) | ||
32 | IDENT@[36; 37) "T" | ||
33 | COLON@[37; 38) | ||
34 | WHITESPACE@[38; 39) | ||
35 | LIFETIME@[39; 41) "'a" | ||
36 | R_ANGLE@[41; 42) | ||
37 | SEMI@[42; 43) | ||
38 | WHITESPACE@[43; 44) | ||
39 | STRUCT_ITEM@[44; 64) | ||
40 | STRUCT_KW@[44; 50) | ||
41 | WHITESPACE@[50; 51) | ||
42 | IDENT@[51; 52) "D" | ||
43 | TYPE_PARAM_LIST@[52; 62) | ||
44 | L_ANGLE@[52; 53) | ||
45 | TYPE_PARAM@[53; 61) | ||
46 | IDENT@[53; 54) "T" | ||
47 | COLON@[54; 55) | ||
48 | WHITESPACE@[55; 56) | ||
49 | LIFETIME@[56; 58) "'a" | ||
50 | WHITESPACE@[58; 59) | ||
51 | PLUS@[59; 60) | ||
52 | WHITESPACE@[60; 61) | ||
53 | R_ANGLE@[61; 62) | ||
54 | SEMI@[62; 63) | ||
55 | WHITESPACE@[63; 64) | ||
56 | STRUCT_ITEM@[64; 87) | ||
57 | STRUCT_KW@[64; 70) | ||
58 | WHITESPACE@[70; 71) | ||
59 | IDENT@[71; 72) "E" | ||
60 | TYPE_PARAM_LIST@[72; 85) | ||
61 | L_ANGLE@[72; 73) | ||
62 | TYPE_PARAM@[73; 84) | ||
63 | IDENT@[73; 74) "T" | ||
64 | COLON@[74; 75) | ||
65 | WHITESPACE@[75; 76) | ||
66 | LIFETIME@[76; 78) "'a" | ||
67 | WHITESPACE@[78; 79) | ||
68 | PLUS@[79; 80) | ||
69 | WHITESPACE@[80; 81) | ||
70 | LIFETIME@[81; 83) "'d" | ||
71 | WHITESPACE@[83; 84) | ||
72 | R_ANGLE@[84; 85) | ||
73 | SEMI@[85; 86) | ||
74 | WHITESPACE@[86; 87) | ||
75 | STRUCT_ITEM@[87; 117) | ||
76 | STRUCT_KW@[87; 93) | ||
77 | WHITESPACE@[93; 94) | ||
78 | IDENT@[94; 95) "F" | ||
79 | TYPE_PARAM_LIST@[95; 115) | ||
80 | L_ANGLE@[95; 96) | ||
81 | TYPE_PARAM@[96; 114) | ||
82 | IDENT@[96; 97) "T" | ||
83 | COLON@[97; 98) | ||
84 | WHITESPACE@[98; 99) | ||
85 | LIFETIME@[99; 101) "'a" | ||
86 | WHITESPACE@[101; 102) | ||
87 | PLUS@[102; 103) | ||
88 | WHITESPACE@[103; 104) | ||
89 | LIFETIME@[104; 106) "'d" | ||
90 | WHITESPACE@[106; 107) | ||
91 | PLUS@[107; 108) | ||
92 | PATH@[108; 114) | ||
93 | PATH_SEGMENT@[108; 114) | ||
94 | WHITESPACE@[108; 109) | ||
95 | IDENT@[109; 114) "Clone" | ||
96 | R_ANGLE@[114; 115) | ||
97 | SEMI@[115; 116) | ||
98 | WHITESPACE@[116; 117) | ||
99 | STRUCT_ITEM@[117; 144) | ||
100 | STRUCT_KW@[117; 123) | ||
101 | WHITESPACE@[123; 124) | ||
102 | IDENT@[124; 125) "G" | ||
103 | TYPE_PARAM_LIST@[125; 142) | ||
104 | L_ANGLE@[125; 126) | ||
105 | TYPE_PARAM@[126; 141) | ||
106 | IDENT@[126; 127) "T" | ||
107 | COLON@[127; 128) | ||
108 | PATH@[128; 135) | ||
109 | PATH_SEGMENT@[128; 135) | ||
110 | WHITESPACE@[128; 129) | ||
111 | IDENT@[129; 134) "Clone" | ||
112 | WHITESPACE@[134; 135) | ||
113 | PLUS@[135; 136) | ||
114 | PATH@[136; 141) | ||
115 | PATH_SEGMENT@[136; 141) | ||
116 | WHITESPACE@[136; 137) | ||
117 | IDENT@[137; 141) "Copy" | ||
118 | R_ANGLE@[141; 142) | ||
119 | SEMI@[142; 143) | ||
120 | WHITESPACE@[143; 144) | ||
121 | STRUCT_ITEM@[144; 181) | ||
122 | STRUCT_KW@[144; 150) | ||
123 | WHITESPACE@[150; 151) | ||
124 | IDENT@[151; 152) "H" | ||
125 | TYPE_PARAM_LIST@[152; 179) | ||
126 | L_ANGLE@[152; 153) | ||
127 | TYPE_PARAM@[153; 178) | ||
128 | IDENT@[153; 154) "T" | ||
129 | COLON@[154; 155) | ||
130 | PATH@[155; 162) | ||
131 | PATH_SEGMENT@[155; 162) | ||
132 | WHITESPACE@[155; 156) | ||
133 | COLONCOLON@[156; 158) | ||
134 | IDENT@[158; 161) "Foo" | ||
135 | WHITESPACE@[161; 162) | ||
136 | PLUS@[162; 163) | ||
137 | PATH@[163; 174) | ||
138 | PATH@[163; 168) | ||
139 | PATH_SEGMENT@[163; 168) | ||
140 | WHITESPACE@[163; 164) | ||
141 | SELF_KW@[164; 168) | ||
142 | COLONCOLON@[168; 170) | ||
143 | PATH_SEGMENT@[170; 174) | ||
144 | IDENT@[170; 173) "Bar" | ||
145 | WHITESPACE@[173; 174) | ||
146 | PLUS@[174; 175) | ||
147 | WHITESPACE@[175; 176) | ||
148 | LIFETIME@[176; 178) "'a" | ||
149 | R_ANGLE@[178; 179) | ||
150 | SEMI@[179; 180) | ||
151 | WHITESPACE@[180; 181) | ||
152 | STRUCT_ITEM@[181; 200) | ||
153 | STRUCT_KW@[181; 187) | ||
154 | WHITESPACE@[187; 188) | ||
155 | IDENT@[188; 189) "I" | ||
156 | TYPE_PARAM_LIST@[189; 198) | ||
157 | L_ANGLE@[189; 190) | ||
158 | TYPE_PARAM@[190; 192) | ||
159 | IDENT@[190; 191) "T" | ||
160 | COLON@[191; 192) | ||
161 | COMMA@[192; 193) | ||
162 | TYPE_PARAM@[193; 196) | ||
163 | WHITESPACE@[193; 194) | ||
164 | IDENT@[194; 195) "U" | ||
165 | COLON@[195; 196) | ||
166 | COMMA@[196; 197) | ||
167 | R_ANGLE@[197; 198) | ||
168 | SEMI@[198; 199) | ||
169 | WHITESPACE@[199; 200) | ||