From 71154d31376f948162c9edf947832d95ff746c3f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 30 Aug 2024 11:43:00 -0400 Subject: [PATCH] update --- src/swc.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/swc.rs b/src/swc.rs index 75ef88d2..f7a4728d 100644 --- a/src/swc.rs +++ b/src/swc.rs @@ -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); @@ -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(