Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Nov 22, 2021
1 parent 1bf0fde commit da8e59a
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 103 deletions.
1 change: 0 additions & 1 deletion crates/rslint_parser/src/parse_recoverer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ impl ParseRecoverer {

fn is_at_braces(&self, parser: &Parser) -> bool {
matches!(parser.cur(), T!['{'] | T!['}'] if self.include_braces)

}

fn is_at_token_set(&self, parser: &Parser) -> bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
0: ERROR@8..9
0: L_CURLY@8..9 "{" [] []
4: R_CURLY@9..10 "}" [] []
1: ERROR@10..11
1: JS_UNKNOWN_STATEMENT@10..11
0: R_CURLY@10..11 "}" [] []
3: EOF@11..12 "" [Whitespace("\n")] []
--
Expand Down
72 changes: 37 additions & 35 deletions crates/rslint_parser/test_data/inline/err/function_broken.rast
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
JS_ROOT@0..26
LIST@0..0
LIST@0..25
JS_FUNCTION_DECLARATION@0..14
FUNCTION_KW@0..8 "function"
WHITESPACE@8..9 " "
JS_IDENTIFIER_BINDING@9..12
IDENT@9..12 "foo"
JS_PARAMETER_LIST@12..14
L_PAREN@12..13 "("
LIST@13..13
R_PAREN@13..14 ")"
JS_UNKNOWN_STATEMENT@14..15
R_PAREN@14..15 ")"
JS_UNKNOWN_STATEMENT@15..16
R_CURLY@15..16 "}"
JS_UNKNOWN_STATEMENT@16..17
R_PAREN@16..17 ")"
JS_UNKNOWN_STATEMENT@17..18
R_CURLY@17..18 "}"
JS_BLOCK_STATEMENT@18..25
L_CURLY@18..19 "{"
LIST@19..25
JS_BLOCK_STATEMENT@19..25
L_CURLY@19..20 "{"
LIST@20..25
JS_BLOCK_STATEMENT@20..25
L_CURLY@20..21 "{"
WHITESPACE@21..23 " "
LIST@23..25
JS_BLOCK_STATEMENT@23..25
L_CURLY@23..24 "{"
LIST@24..24
R_CURLY@24..25 "}"
WHITESPACE@25..26 "\n"
0: JS_ROOT@0..26
0: (empty)
1: LIST@0..0
2: LIST@0..25
0: JS_FUNCTION_DECLARATION@0..14
0: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")]
1: JS_IDENTIFIER_BINDING@9..12
0: IDENT@9..12 "foo" [] []
2: JS_PARAMETER_LIST@12..14
0: L_PAREN@12..13 "(" [] []
1: LIST@13..13
2: R_PAREN@13..14 ")" [] []
1: JS_UNKNOWN_STATEMENT@14..15
0: R_PAREN@14..15 ")" [] []
2: JS_UNKNOWN_STATEMENT@15..16
0: R_CURLY@15..16 "}" [] []
3: JS_UNKNOWN_STATEMENT@16..17
0: R_PAREN@16..17 ")" [] []
4: JS_UNKNOWN_STATEMENT@17..18
0: R_CURLY@17..18 "}" [] []
5: JS_BLOCK_STATEMENT@18..25
0: L_CURLY@18..19 "{" [] []
1: LIST@19..25
0: JS_BLOCK_STATEMENT@19..25
0: L_CURLY@19..20 "{" [] []
1: LIST@20..25
0: JS_BLOCK_STATEMENT@20..25
0: L_CURLY@20..23 "{" [] [Whitespace(" ")]
1: LIST@23..25
0: JS_BLOCK_STATEMENT@23..25
0: L_CURLY@23..24 "{" [] []
1: LIST@24..24
2: R_CURLY@24..25 "}" [] []
2: (empty)
2: (empty)
2: (empty)
3: EOF@25..26 "" [Whitespace("\n")] []
--
error[SyntaxError]: expected a block statement but instead found `)`
┌─ function_broken.js:1:15
Expand Down
47 changes: 23 additions & 24 deletions crates/rslint_parser/test_data/inline/err/if_broken.rast
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
JS_ROOT@0..17
LIST@0..0
LIST@0..16
JS_IF_STATEMENT@0..10
IF_KW@0..2 "if"
WHITESPACE@2..3 " "
L_PAREN@3..4 "("
JS_BOOLEAN_LITERAL@4..8
TRUE_KW@4..8 "true"
R_PAREN@8..9 ")"
JS_UNKNOWN_STATEMENT@9..10
R_CURLY@9..10 "}"
JS_UNKNOWN_STATEMENT@10..11
R_CURLY@10..11 "}"
JS_UNKNOWN_STATEMENT@11..12
R_CURLY@11..12 "}"
JS_UNKNOWN_STATEMENT@12..13
R_CURLY@12..13 "}"
WHITESPACE@13..14 " "
JS_BLOCK_STATEMENT@14..16
L_CURLY@14..15 "{"
LIST@15..15
R_CURLY@15..16 "}"
WHITESPACE@16..17 "\n"
0: JS_ROOT@0..17
0: (empty)
1: LIST@0..0
2: LIST@0..16
0: JS_IF_STATEMENT@0..10
0: IF_KW@0..3 "if" [] [Whitespace(" ")]
1: L_PAREN@3..4 "(" [] []
2: JS_BOOLEAN_LITERAL@4..8
0: TRUE_KW@4..8 "true" [] []
3: R_PAREN@8..9 ")" [] []
4: JS_UNKNOWN_STATEMENT@9..10
0: R_CURLY@9..10 "}" [] []
1: JS_UNKNOWN_STATEMENT@10..11
0: R_CURLY@10..11 "}" [] []
2: JS_UNKNOWN_STATEMENT@11..12
0: R_CURLY@11..12 "}" [] []
3: JS_UNKNOWN_STATEMENT@12..14
0: R_CURLY@12..14 "}" [] [Whitespace(" ")]
4: JS_BLOCK_STATEMENT@14..16
0: L_CURLY@14..15 "{" [] []
1: LIST@15..15
2: R_CURLY@15..16 "}" [] []
3: EOF@16..17 "" [Whitespace("\n")] []
--
error[SyntaxError]: Expected a statement or declaration, but found none
┌─ if_broken.js:1:10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
0: L_CURLY@36..37 "{" [] []
2: R_CURLY@37..38 "}" [] []
1: (empty)
2: ERROR@38..39
2: JS_UNKNOWN_STATEMENT@38..39
0: R_CURLY@38..39 "}" [] []
3: EOF@39..40 "" [Whitespace("\n")] []
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
2: (empty)
1: JS_NUMBER_LITERAL_TOKEN@5..6 "5" [] []
1: (empty)
1: ERROR@6..8
1: JS_UNKNOWN_STATEMENT@6..8
0: R_PAREN@6..8 ")" [] [Whitespace(" ")]
2: ERROR@8..11
2: JS_UNKNOWN_STATEMENT@8..11
0: FAT_ARROW@8..11 "=>" [] [Whitespace(" ")]
3: JS_BLOCK_STATEMENT@11..13
0: L_CURLY@11..12 "{" [] []
Expand All @@ -37,9 +37,9 @@
0: JS_REFERENCE_IDENTIFIER_EXPRESSION@19..20
0: IDENT@19..20 "b" [] []
1: (empty)
6: ERROR@20..22
6: JS_UNKNOWN_STATEMENT@20..22
0: R_PAREN@20..22 ")" [] [Whitespace(" ")]
7: ERROR@22..25
7: JS_UNKNOWN_STATEMENT@22..25
0: FAT_ARROW@22..25 "=>" [] [Whitespace(" ")]
8: JS_BLOCK_STATEMENT@25..27
0: L_CURLY@25..26 "{" [] []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
JS_ROOT@0..43
LIST@0..0
LIST@0..42
JS_SWITCH_STATEMENT@0..42
SWITCH_KW@0..6 "switch"
WHITESPACE@6..7 " "
L_PAREN@7..8 "("
JS_REFERENCE_IDENTIFIER_EXPRESSION@8..11
IDENT@8..11 "foo"
R_PAREN@11..12 ")"
WHITESPACE@12..13 " "
L_CURLY@13..14 "{"
WHITESPACE@14..16 "\n\t"
LIST@16..40
JS_DEFAULT_CLAUSE@16..27
DEFAULT_KW@16..23 "default"
COLON@23..24 ":"
WHITESPACE@24..25 " "
LIST@25..27
JS_BLOCK_STATEMENT@25..27
L_CURLY@25..26 "{"
LIST@26..26
R_CURLY@26..27 "}"
WHITESPACE@27..29 "\n\t"
JS_DEFAULT_CLAUSE@29..40
DEFAULT_KW@29..36 "default"
COLON@36..37 ":"
WHITESPACE@37..38 " "
LIST@38..40
JS_BLOCK_STATEMENT@38..40
L_CURLY@38..39 "{"
LIST@39..39
R_CURLY@39..40 "}"
WHITESPACE@40..41 "\n"
R_CURLY@41..42 "}"
WHITESPACE@42..43 "\n"
0: JS_ROOT@0..43
0: (empty)
1: LIST@0..0
2: LIST@0..42
0: JS_SWITCH_STATEMENT@0..42
0: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")]
1: L_PAREN@7..8 "(" [] []
2: JS_REFERENCE_IDENTIFIER_EXPRESSION@8..11
0: IDENT@8..11 "foo" [] []
3: R_PAREN@11..13 ")" [] [Whitespace(" ")]
4: L_CURLY@13..14 "{" [] []
5: LIST@14..40
0: JS_DEFAULT_CLAUSE@14..27
0: DEFAULT_KW@14..23 "default" [Whitespace("\n\t")] []
1: COLON@23..25 ":" [] [Whitespace(" ")]
2: LIST@25..27
0: JS_BLOCK_STATEMENT@25..27
0: L_CURLY@25..26 "{" [] []
1: LIST@26..26
2: R_CURLY@26..27 "}" [] []
1: JS_DEFAULT_CLAUSE@27..40
0: DEFAULT_KW@27..36 "default" [Whitespace("\n\t")] []
1: COLON@36..38 ":" [] [Whitespace(" ")]
2: LIST@38..40
0: JS_BLOCK_STATEMENT@38..40
0: L_CURLY@38..39 "{" [] []
1: LIST@39..39
2: R_CURLY@39..40 "}" [] []
6: R_CURLY@40..42 "}" [Whitespace("\n")] []
3: EOF@42..43 "" [Whitespace("\n")] []
--
error[SyntaxError]: Multiple default clauses inside of a switch statement are not allowed
┌─ switch_stmt_double_default.js:3:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
2: JS_BOOLEAN_LITERAL@44..48
0: TRUE_KW@44..48 "true" [] []
3: R_PAREN@48..50 ")" [] [Whitespace(" ")]
4: ERROR@50..51
4: JS_UNKNOWN_STATEMENT@50..51
0: R_CURLY@50..51 "}" [] []
3: EOF@51..52 "" [Whitespace("\n")] []
--
Expand Down

0 comments on commit da8e59a

Please sign in to comment.