Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Aug 30, 2024
1 parent 1ad774d commit 71154d3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/swc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ mod tests {
);
}

#[test]
fn it_should_error_when_var_stmts_sep_by_comma() {
run_fatal_diagnostic_test(
"./test.ts",
"let a = 0, let b = 1;",
concat!(
"Unexpected token `let`. Expected let is reserved in const, let, class declaration at file:///test.ts:1:12\n",
"\n",
" let a = 0, let b = 1;\n",
" ~~~"
),
);
}

fn run_fatal_diagnostic_test(file_path: &str, text: &str, expected: &str) {
let file_path = PathBuf::from(file_path);
assert_eq!(parse_swc_ast(&file_path, text.into()).err().unwrap().to_string(), expected);
Expand All @@ -263,20 +277,6 @@ mod tests {
);
}

#[test]
fn it_should_error_when_var_stmts_sep_by_comma() {
run_non_fatal_diagnostic_test(
"./test.ts",
"let a = 0, let b = 1;",
concat!(
"Expected a semicolon at file:///test.ts:1:16\n",
"\n",
" let a = 0, let b = 1;\n",
" ~"
),
);
}

#[test]
fn it_should_error_for_exected_expr_issue_121() {
run_non_fatal_diagnostic_test(
Expand Down

0 comments on commit 71154d3

Please sign in to comment.