diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-06-30 11:05:51 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-06-30 11:05:51 +0100 |
commit | e18389d2684a8da9937fe37f9598fabf67c65fee (patch) | |
tree | 57b5338eb38b1f6cd0a254a7f3aa793bb44d815e /crates/ra_syntax/tests/data/parser | |
parent | fb2534f30089ddd796dbf52c7bb639efe5d10a3e (diff) | |
parent | 2959aa446e452d2176f9db453e52047453a3904e (diff) |
Merge #1461
1461: Support attributes on array members r=matklad a=etaoins
Array members are allowed to have attributes such as `#[cfg]`.
Co-authored-by: Ryan Cumming <[email protected]>
Diffstat (limited to 'crates/ra_syntax/tests/data/parser')
4 files changed, 112 insertions, 0 deletions
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0135_first_array_member_attributes.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0135_first_array_member_attributes.rs new file mode 100644 index 000000000..f59e13771 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0135_first_array_member_attributes.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | pub const A: &[i64] = &[ | ||
2 | #[cfg(test)] | ||
3 | 1, | ||
4 | 2, | ||
5 | ]; | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0135_first_array_member_attributes.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0135_first_array_member_attributes.txt new file mode 100644 index 000000000..eac4f6f30 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0135_first_array_member_attributes.txt | |||
@@ -0,0 +1,51 @@ | |||
1 | SOURCE_FILE@[0; 56) | ||
2 | CONST_DEF@[0; 55) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) "pub" | ||
5 | WHITESPACE@[3; 4) " " | ||
6 | CONST_KW@[4; 9) "const" | ||
7 | WHITESPACE@[9; 10) " " | ||
8 | NAME@[10; 11) | ||
9 | IDENT@[10; 11) "A" | ||
10 | COLON@[11; 12) ":" | ||
11 | WHITESPACE@[12; 13) " " | ||
12 | REFERENCE_TYPE@[13; 19) | ||
13 | AMP@[13; 14) "&" | ||
14 | SLICE_TYPE@[14; 19) | ||
15 | L_BRACK@[14; 15) "[" | ||
16 | PATH_TYPE@[15; 18) | ||
17 | PATH@[15; 18) | ||
18 | PATH_SEGMENT@[15; 18) | ||
19 | NAME_REF@[15; 18) | ||
20 | IDENT@[15; 18) "i64" | ||
21 | R_BRACK@[18; 19) "]" | ||
22 | WHITESPACE@[19; 20) " " | ||
23 | EQ@[20; 21) "=" | ||
24 | WHITESPACE@[21; 22) " " | ||
25 | REF_EXPR@[22; 54) | ||
26 | AMP@[22; 23) "&" | ||
27 | ARRAY_EXPR@[23; 54) | ||
28 | L_BRACK@[23; 24) "[" | ||
29 | WHITESPACE@[24; 28) "\n " | ||
30 | ATTR@[28; 40) | ||
31 | POUND@[28; 29) "#" | ||
32 | TOKEN_TREE@[29; 40) | ||
33 | L_BRACK@[29; 30) "[" | ||
34 | IDENT@[30; 33) "cfg" | ||
35 | TOKEN_TREE@[33; 39) | ||
36 | L_PAREN@[33; 34) "(" | ||
37 | IDENT@[34; 38) "test" | ||
38 | R_PAREN@[38; 39) ")" | ||
39 | R_BRACK@[39; 40) "]" | ||
40 | WHITESPACE@[40; 44) "\n " | ||
41 | LITERAL@[44; 45) | ||
42 | INT_NUMBER@[44; 45) "1" | ||
43 | COMMA@[45; 46) "," | ||
44 | WHITESPACE@[46; 50) "\n " | ||
45 | LITERAL@[50; 51) | ||
46 | INT_NUMBER@[50; 51) "2" | ||
47 | COMMA@[51; 52) "," | ||
48 | WHITESPACE@[52; 53) "\n" | ||
49 | R_BRACK@[53; 54) "]" | ||
50 | SEMI@[54; 55) ";" | ||
51 | WHITESPACE@[55; 56) "\n" | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0136_subsequent_array_member_attributes.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0136_subsequent_array_member_attributes.rs new file mode 100644 index 000000000..1324acb3f --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0136_subsequent_array_member_attributes.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | pub const A: &[i64] = &[ | ||
2 | 1, | ||
3 | #[cfg(test)] | ||
4 | 2, | ||
5 | ]; | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0136_subsequent_array_member_attributes.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0136_subsequent_array_member_attributes.txt new file mode 100644 index 000000000..6fa1b42d9 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0136_subsequent_array_member_attributes.txt | |||
@@ -0,0 +1,51 @@ | |||
1 | SOURCE_FILE@[0; 56) | ||
2 | CONST_DEF@[0; 55) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) "pub" | ||
5 | WHITESPACE@[3; 4) " " | ||
6 | CONST_KW@[4; 9) "const" | ||
7 | WHITESPACE@[9; 10) " " | ||
8 | NAME@[10; 11) | ||
9 | IDENT@[10; 11) "A" | ||
10 | COLON@[11; 12) ":" | ||
11 | WHITESPACE@[12; 13) " " | ||
12 | REFERENCE_TYPE@[13; 19) | ||
13 | AMP@[13; 14) "&" | ||
14 | SLICE_TYPE@[14; 19) | ||
15 | L_BRACK@[14; 15) "[" | ||
16 | PATH_TYPE@[15; 18) | ||
17 | PATH@[15; 18) | ||
18 | PATH_SEGMENT@[15; 18) | ||
19 | NAME_REF@[15; 18) | ||
20 | IDENT@[15; 18) "i64" | ||
21 | R_BRACK@[18; 19) "]" | ||
22 | WHITESPACE@[19; 20) " " | ||
23 | EQ@[20; 21) "=" | ||
24 | WHITESPACE@[21; 22) " " | ||
25 | REF_EXPR@[22; 54) | ||
26 | AMP@[22; 23) "&" | ||
27 | ARRAY_EXPR@[23; 54) | ||
28 | L_BRACK@[23; 24) "[" | ||
29 | WHITESPACE@[24; 28) "\n " | ||
30 | LITERAL@[28; 29) | ||
31 | INT_NUMBER@[28; 29) "1" | ||
32 | COMMA@[29; 30) "," | ||
33 | WHITESPACE@[30; 34) "\n " | ||
34 | ATTR@[34; 46) | ||
35 | POUND@[34; 35) "#" | ||
36 | TOKEN_TREE@[35; 46) | ||
37 | L_BRACK@[35; 36) "[" | ||
38 | IDENT@[36; 39) "cfg" | ||
39 | TOKEN_TREE@[39; 45) | ||
40 | L_PAREN@[39; 40) "(" | ||
41 | IDENT@[40; 44) "test" | ||
42 | R_PAREN@[44; 45) ")" | ||
43 | R_BRACK@[45; 46) "]" | ||
44 | WHITESPACE@[46; 50) "\n " | ||
45 | LITERAL@[50; 51) | ||
46 | INT_NUMBER@[50; 51) "2" | ||
47 | COMMA@[51; 52) "," | ||
48 | WHITESPACE@[52; 53) "\n" | ||
49 | R_BRACK@[53; 54) "]" | ||
50 | SEMI@[54; 55) ";" | ||
51 | WHITESPACE@[55; 56) "\n" | ||