diff options
Diffstat (limited to 'crates/ra_syntax/tests')
4 files changed, 78 insertions, 6 deletions
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0010_bad_tuple_index_expr.rs b/crates/ra_syntax/tests/data/parser/inline/err/0010_bad_tuple_index_expr.rs new file mode 100644 index 000000000..30cc49138 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0010_bad_tuple_index_expr.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn foo() { | ||
2 | x.0.; | ||
3 | x.1i32; | ||
4 | x.0x01; | ||
5 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0010_bad_tuple_index_expr.txt b/crates/ra_syntax/tests/data/parser/inline/err/0010_bad_tuple_index_expr.txt new file mode 100644 index 000000000..c111f60ea --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0010_bad_tuple_index_expr.txt | |||
@@ -0,0 +1,51 @@ | |||
1 | SOURCE_FILE@[0; 47) | ||
2 | FN_DEF@[0; 46) | ||
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; 46) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 15) "\n " | ||
14 | EXPR_STMT@[15; 20) | ||
15 | FIELD_EXPR@[15; 19) | ||
16 | PATH_EXPR@[15; 16) | ||
17 | PATH@[15; 16) | ||
18 | PATH_SEGMENT@[15; 16) | ||
19 | NAME_REF@[15; 16) | ||
20 | IDENT@[15; 16) "x" | ||
21 | DOT@[16; 17) "." | ||
22 | err: `Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix` | ||
23 | FLOAT_NUMBER@[17; 19) "0." | ||
24 | SEMI@[19; 20) ";" | ||
25 | WHITESPACE@[20; 25) "\n " | ||
26 | EXPR_STMT@[25; 32) | ||
27 | FIELD_EXPR@[25; 31) | ||
28 | PATH_EXPR@[25; 26) | ||
29 | PATH@[25; 26) | ||
30 | PATH_SEGMENT@[25; 26) | ||
31 | NAME_REF@[25; 26) | ||
32 | IDENT@[25; 26) "x" | ||
33 | DOT@[26; 27) "." | ||
34 | err: `Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix` | ||
35 | INT_NUMBER@[27; 31) "1i32" | ||
36 | SEMI@[31; 32) ";" | ||
37 | WHITESPACE@[32; 37) "\n " | ||
38 | EXPR_STMT@[37; 44) | ||
39 | FIELD_EXPR@[37; 43) | ||
40 | PATH_EXPR@[37; 38) | ||
41 | PATH@[37; 38) | ||
42 | PATH_SEGMENT@[37; 38) | ||
43 | NAME_REF@[37; 38) | ||
44 | IDENT@[37; 38) "x" | ||
45 | DOT@[38; 39) "." | ||
46 | err: `Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix` | ||
47 | INT_NUMBER@[39; 43) "0x01" | ||
48 | SEMI@[43; 44) ";" | ||
49 | WHITESPACE@[44; 45) "\n" | ||
50 | R_CURLY@[45; 46) "}" | ||
51 | WHITESPACE@[46; 47) "\n" | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.rs index 3e69538e5..b8da2ddc3 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.rs +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.rs | |||
@@ -1,4 +1,5 @@ | |||
1 | fn foo() { | 1 | fn foo() { |
2 | x.foo; | 2 | x.foo; |
3 | x.0.bar; | 3 | x.0.bar; |
4 | x.0(); | ||
4 | } | 5 | } |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.txt index a86702843..78054ec5a 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0011_field_expr.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 37) | 1 | SOURCE_FILE@[0; 48) |
2 | FN_DEF@[0; 36) | 2 | FN_DEF@[0; 47) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 37) | |||
8 | L_PAREN@[6; 7) "(" | 8 | L_PAREN@[6; 7) "(" |
9 | R_PAREN@[7; 8) ")" | 9 | R_PAREN@[7; 8) ")" |
10 | WHITESPACE@[8; 9) " " | 10 | WHITESPACE@[8; 9) " " |
11 | BLOCK@[9; 36) | 11 | BLOCK@[9; 47) |
12 | L_CURLY@[9; 10) "{" | 12 | L_CURLY@[9; 10) "{" |
13 | WHITESPACE@[10; 15) "\n " | 13 | WHITESPACE@[10; 15) "\n " |
14 | EXPR_STMT@[15; 21) | 14 | EXPR_STMT@[15; 21) |
@@ -37,6 +37,21 @@ SOURCE_FILE@[0; 37) | |||
37 | NAME_REF@[30; 33) | 37 | NAME_REF@[30; 33) |
38 | IDENT@[30; 33) "bar" | 38 | IDENT@[30; 33) "bar" |
39 | SEMI@[33; 34) ";" | 39 | SEMI@[33; 34) ";" |
40 | WHITESPACE@[34; 35) "\n" | 40 | WHITESPACE@[34; 39) "\n " |
41 | R_CURLY@[35; 36) "}" | 41 | EXPR_STMT@[39; 45) |
42 | WHITESPACE@[36; 37) "\n" | 42 | CALL_EXPR@[39; 44) |
43 | FIELD_EXPR@[39; 42) | ||
44 | PATH_EXPR@[39; 40) | ||
45 | PATH@[39; 40) | ||
46 | PATH_SEGMENT@[39; 40) | ||
47 | NAME_REF@[39; 40) | ||
48 | IDENT@[39; 40) "x" | ||
49 | DOT@[40; 41) "." | ||
50 | INT_NUMBER@[41; 42) "0" | ||
51 | ARG_LIST@[42; 44) | ||
52 | L_PAREN@[42; 43) "(" | ||
53 | R_PAREN@[43; 44) ")" | ||
54 | SEMI@[44; 45) ";" | ||
55 | WHITESPACE@[45; 46) "\n" | ||
56 | R_CURLY@[46; 47) "}" | ||
57 | WHITESPACE@[47; 48) "\n" | ||