From 81f5719fd578644b63c2a6cc8cad70bc7f66e63b Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Thu, 15 Sep 2022 00:54:12 +0100 Subject: [PATCH] parser: add test case for static arrow functions returning by ref --- trunk_parser/src/parser/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/trunk_parser/src/parser/mod.rs b/trunk_parser/src/parser/mod.rs index bf23e1a..8c2e9e4 100644 --- a/trunk_parser/src/parser/mod.rs +++ b/trunk_parser/src/parser/mod.rs @@ -3972,6 +3972,20 @@ mod tests { ]); } + #[test] + fn static_arrow_functions_returning_by_ref() { + assert_ast( + " null;", + &[expr!(Expression::ArrowFunction { + params: vec![], + expr: Box::new(Expression::Null), + return_type: None, + by_ref: true, + r#static: true, + })], + ); + } + fn assert_ast(source: &str, expected: &[Statement]) { let mut lexer = Lexer::new(None); let tokens = lexer.tokenize(source).unwrap();