diff options
author | bravomikekilo <[email protected]> | 2019-08-14 14:20:04 +0100 |
---|---|---|
committer | bravomikekilo <[email protected]> | 2019-08-14 14:20:04 +0100 |
commit | 4f31fed362e1bb08f748b188eedc0bdc5a070bee (patch) | |
tree | 104dad5eb640cb992b984191ea70b3259d8535fb /crates | |
parent | 3fce56280feeb7d621cd98a61c6157393be72c00 (diff) |
fix test position
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 16 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_block.txt | 105 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.txt | 40 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rs (renamed from crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_block.rs) | 3 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/ok/0052_for_range_block.txt | 79 |
6 files changed, 130 insertions, 118 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 6e25e3cb4..50c70b3b3 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -111,6 +111,12 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar | |||
111 | block_expr(p, Some(m)) | 111 | block_expr(p, Some(m)) |
112 | } | 112 | } |
113 | T!['{'] => { | 113 | T!['{'] => { |
114 | // test for_range_from | ||
115 | // fn foo() { | ||
116 | // for x in 0 .. { | ||
117 | // break; | ||
118 | // } | ||
119 | // } | ||
114 | if r.forbid_structs { | 120 | if r.forbid_structs { |
115 | return None; | 121 | return None; |
116 | } else { | 122 | } else { |
@@ -313,16 +319,6 @@ fn while_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | |||
313 | // fn foo() { | 319 | // fn foo() { |
314 | // for x in [] {}; | 320 | // for x in [] {}; |
315 | // } | 321 | // } |
316 | |||
317 | // test for_range_block | ||
318 | // fn foo() { | ||
319 | // for x in 0 .. { | ||
320 | // break; | ||
321 | // } | ||
322 | // for _x in 0 .. (0 .. {1 + 2}).sum::<u32>() { | ||
323 | // break; | ||
324 | // } | ||
325 | // } | ||
326 | fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { | 322 | fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker { |
327 | assert!(p.at(T![for])); | 323 | assert!(p.at(T![for])); |
328 | let m = m.unwrap_or_else(|| p.start()); | 324 | let m = m.unwrap_or_else(|| p.start()); |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_block.txt b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_block.txt deleted file mode 100644 index 7da4dbb8b..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_block.txt +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | SOURCE_FILE@[0; 118) | ||
2 | FN_DEF@[0; 117) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | R_PAREN@[7; 8) ")" | ||
10 | WHITESPACE@[8; 9) " " | ||
11 | BLOCK@[9; 117) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 14) "\n " | ||
14 | EXPR_STMT@[14; 48) | ||
15 | FOR_EXPR@[14; 48) | ||
16 | FOR_KW@[14; 17) "for" | ||
17 | WHITESPACE@[17; 18) " " | ||
18 | BIND_PAT@[18; 19) | ||
19 | NAME@[18; 19) | ||
20 | IDENT@[18; 19) "x" | ||
21 | WHITESPACE@[19; 20) " " | ||
22 | IN_KW@[20; 22) "in" | ||
23 | WHITESPACE@[22; 23) " " | ||
24 | RANGE_EXPR@[23; 27) | ||
25 | LITERAL@[23; 24) | ||
26 | INT_NUMBER@[23; 24) "0" | ||
27 | WHITESPACE@[24; 25) " " | ||
28 | DOTDOT@[25; 27) ".." | ||
29 | WHITESPACE@[27; 28) " " | ||
30 | BLOCK@[28; 48) | ||
31 | L_CURLY@[28; 29) "{" | ||
32 | WHITESPACE@[29; 37) "\n " | ||
33 | EXPR_STMT@[37; 43) | ||
34 | BREAK_EXPR@[37; 42) | ||
35 | BREAK_KW@[37; 42) "break" | ||
36 | SEMI@[42; 43) ";" | ||
37 | WHITESPACE@[43; 47) "\n " | ||
38 | R_CURLY@[47; 48) "}" | ||
39 | WHITESPACE@[48; 52) "\n " | ||
40 | FOR_EXPR@[52; 115) | ||
41 | FOR_KW@[52; 55) "for" | ||
42 | WHITESPACE@[55; 56) " " | ||
43 | BIND_PAT@[56; 58) | ||
44 | NAME@[56; 58) | ||
45 | IDENT@[56; 58) "_x" | ||
46 | WHITESPACE@[58; 59) " " | ||
47 | IN_KW@[59; 61) "in" | ||
48 | WHITESPACE@[61; 62) " " | ||
49 | RANGE_EXPR@[62; 94) | ||
50 | LITERAL@[62; 63) | ||
51 | INT_NUMBER@[62; 63) "0" | ||
52 | WHITESPACE@[63; 64) " " | ||
53 | DOTDOT@[64; 66) ".." | ||
54 | WHITESPACE@[66; 67) " " | ||
55 | METHOD_CALL_EXPR@[67; 94) | ||
56 | PAREN_EXPR@[67; 81) | ||
57 | L_PAREN@[67; 68) "(" | ||
58 | RANGE_EXPR@[68; 80) | ||
59 | LITERAL@[68; 69) | ||
60 | INT_NUMBER@[68; 69) "0" | ||
61 | WHITESPACE@[69; 70) " " | ||
62 | DOTDOT@[70; 72) ".." | ||
63 | WHITESPACE@[72; 73) " " | ||
64 | BLOCK_EXPR@[73; 80) | ||
65 | BLOCK@[73; 80) | ||
66 | L_CURLY@[73; 74) "{" | ||
67 | BIN_EXPR@[74; 79) | ||
68 | LITERAL@[74; 75) | ||
69 | INT_NUMBER@[74; 75) "1" | ||
70 | WHITESPACE@[75; 76) " " | ||
71 | PLUS@[76; 77) "+" | ||
72 | WHITESPACE@[77; 78) " " | ||
73 | LITERAL@[78; 79) | ||
74 | INT_NUMBER@[78; 79) "2" | ||
75 | R_CURLY@[79; 80) "}" | ||
76 | R_PAREN@[80; 81) ")" | ||
77 | DOT@[81; 82) "." | ||
78 | NAME_REF@[82; 85) | ||
79 | IDENT@[82; 85) "sum" | ||
80 | TYPE_ARG_LIST@[85; 92) | ||
81 | COLONCOLON@[85; 87) "::" | ||
82 | L_ANGLE@[87; 88) "<" | ||
83 | TYPE_ARG@[88; 91) | ||
84 | PATH_TYPE@[88; 91) | ||
85 | PATH@[88; 91) | ||
86 | PATH_SEGMENT@[88; 91) | ||
87 | NAME_REF@[88; 91) | ||
88 | IDENT@[88; 91) "u32" | ||
89 | R_ANGLE@[91; 92) ">" | ||
90 | ARG_LIST@[92; 94) | ||
91 | L_PAREN@[92; 93) "(" | ||
92 | R_PAREN@[93; 94) ")" | ||
93 | WHITESPACE@[94; 95) " " | ||
94 | BLOCK@[95; 115) | ||
95 | L_CURLY@[95; 96) "{" | ||
96 | WHITESPACE@[96; 104) "\n " | ||
97 | EXPR_STMT@[104; 110) | ||
98 | BREAK_EXPR@[104; 109) | ||
99 | BREAK_KW@[104; 109) "break" | ||
100 | SEMI@[109; 110) ";" | ||
101 | WHITESPACE@[110; 114) "\n " | ||
102 | R_CURLY@[114; 115) "}" | ||
103 | WHITESPACE@[115; 116) "\n" | ||
104 | R_CURLY@[116; 117) "}" | ||
105 | WHITESPACE@[117; 118) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rs b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rs new file mode 100644 index 000000000..af0d40a7a --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn foo() { | ||
2 | for x in 0 .. { | ||
3 | break; | ||
4 | } | ||
5 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.txt b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.txt new file mode 100644 index 000000000..9e5836233 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.txt | |||
@@ -0,0 +1,40 @@ | |||
1 | SOURCE_FILE@[0; 51) | ||
2 | FN_DEF@[0; 50) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | R_PAREN@[7; 8) ")" | ||
10 | WHITESPACE@[8; 9) " " | ||
11 | BLOCK@[9; 50) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 14) "\n " | ||
14 | FOR_EXPR@[14; 48) | ||
15 | FOR_KW@[14; 17) "for" | ||
16 | WHITESPACE@[17; 18) " " | ||
17 | BIND_PAT@[18; 19) | ||
18 | NAME@[18; 19) | ||
19 | IDENT@[18; 19) "x" | ||
20 | WHITESPACE@[19; 20) " " | ||
21 | IN_KW@[20; 22) "in" | ||
22 | WHITESPACE@[22; 23) " " | ||
23 | RANGE_EXPR@[23; 27) | ||
24 | LITERAL@[23; 24) | ||
25 | INT_NUMBER@[23; 24) "0" | ||
26 | WHITESPACE@[24; 25) " " | ||
27 | DOTDOT@[25; 27) ".." | ||
28 | WHITESPACE@[27; 28) " " | ||
29 | BLOCK@[28; 48) | ||
30 | L_CURLY@[28; 29) "{" | ||
31 | WHITESPACE@[29; 37) "\n " | ||
32 | EXPR_STMT@[37; 43) | ||
33 | BREAK_EXPR@[37; 42) | ||
34 | BREAK_KW@[37; 42) "break" | ||
35 | SEMI@[42; 43) ";" | ||
36 | WHITESPACE@[43; 47) "\n " | ||
37 | R_CURLY@[47; 48) "}" | ||
38 | WHITESPACE@[48; 49) "\n" | ||
39 | R_CURLY@[49; 50) "}" | ||
40 | WHITESPACE@[50; 51) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_block.rs b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rs index eb745767b..b51b19630 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_block.rs +++ b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rs | |||
@@ -1,7 +1,4 @@ | |||
1 | fn foo() { | 1 | fn foo() { |
2 | for x in 0 .. { | ||
3 | break; | ||
4 | } | ||
5 | for _x in 0 .. (0 .. {1 + 2}).sum::<u32>() { | 2 | for _x in 0 .. (0 .. {1 + 2}).sum::<u32>() { |
6 | break; | 3 | break; |
7 | } | 4 | } |
diff --git a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.txt b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.txt new file mode 100644 index 000000000..858f042c6 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.txt | |||
@@ -0,0 +1,79 @@ | |||
1 | SOURCE_FILE@[0; 80) | ||
2 | FN_DEF@[0; 79) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | R_PAREN@[7; 8) ")" | ||
10 | WHITESPACE@[8; 9) " " | ||
11 | BLOCK@[9; 79) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 14) "\n " | ||
14 | FOR_EXPR@[14; 77) | ||
15 | FOR_KW@[14; 17) "for" | ||
16 | WHITESPACE@[17; 18) " " | ||
17 | BIND_PAT@[18; 20) | ||
18 | NAME@[18; 20) | ||
19 | IDENT@[18; 20) "_x" | ||
20 | WHITESPACE@[20; 21) " " | ||
21 | IN_KW@[21; 23) "in" | ||
22 | WHITESPACE@[23; 24) " " | ||
23 | RANGE_EXPR@[24; 56) | ||
24 | LITERAL@[24; 25) | ||
25 | INT_NUMBER@[24; 25) "0" | ||
26 | WHITESPACE@[25; 26) " " | ||
27 | DOTDOT@[26; 28) ".." | ||
28 | WHITESPACE@[28; 29) " " | ||
29 | METHOD_CALL_EXPR@[29; 56) | ||
30 | PAREN_EXPR@[29; 43) | ||
31 | L_PAREN@[29; 30) "(" | ||
32 | RANGE_EXPR@[30; 42) | ||
33 | LITERAL@[30; 31) | ||
34 | INT_NUMBER@[30; 31) "0" | ||
35 | WHITESPACE@[31; 32) " " | ||
36 | DOTDOT@[32; 34) ".." | ||
37 | WHITESPACE@[34; 35) " " | ||
38 | BLOCK_EXPR@[35; 42) | ||
39 | BLOCK@[35; 42) | ||
40 | L_CURLY@[35; 36) "{" | ||
41 | BIN_EXPR@[36; 41) | ||
42 | LITERAL@[36; 37) | ||
43 | INT_NUMBER@[36; 37) "1" | ||
44 | WHITESPACE@[37; 38) " " | ||
45 | PLUS@[38; 39) "+" | ||
46 | WHITESPACE@[39; 40) " " | ||
47 | LITERAL@[40; 41) | ||
48 | INT_NUMBER@[40; 41) "2" | ||
49 | R_CURLY@[41; 42) "}" | ||
50 | R_PAREN@[42; 43) ")" | ||
51 | DOT@[43; 44) "." | ||
52 | NAME_REF@[44; 47) | ||
53 | IDENT@[44; 47) "sum" | ||
54 | TYPE_ARG_LIST@[47; 54) | ||
55 | COLONCOLON@[47; 49) "::" | ||
56 | L_ANGLE@[49; 50) "<" | ||
57 | TYPE_ARG@[50; 53) | ||
58 | PATH_TYPE@[50; 53) | ||
59 | PATH@[50; 53) | ||
60 | PATH_SEGMENT@[50; 53) | ||
61 | NAME_REF@[50; 53) | ||
62 | IDENT@[50; 53) "u32" | ||
63 | R_ANGLE@[53; 54) ">" | ||
64 | ARG_LIST@[54; 56) | ||
65 | L_PAREN@[54; 55) "(" | ||
66 | R_PAREN@[55; 56) ")" | ||
67 | WHITESPACE@[56; 57) " " | ||
68 | BLOCK@[57; 77) | ||
69 | L_CURLY@[57; 58) "{" | ||
70 | WHITESPACE@[58; 66) "\n " | ||
71 | EXPR_STMT@[66; 72) | ||
72 | BREAK_EXPR@[66; 71) | ||
73 | BREAK_KW@[66; 71) "break" | ||
74 | SEMI@[71; 72) ";" | ||
75 | WHITESPACE@[72; 76) "\n " | ||
76 | R_CURLY@[76; 77) "}" | ||
77 | WHITESPACE@[77; 78) "\n" | ||
78 | R_CURLY@[78; 79) "}" | ||
79 | WHITESPACE@[79; 80) "\n" | ||