parser: add test case for static arrow functions returning by ref

This commit is contained in:
Ryan Chandler 2022-09-15 00:54:12 +01:00
parent 05aff40752
commit 81f5719fd5
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -3972,6 +3972,20 @@ mod tests {
]);
}
#[test]
fn static_arrow_functions_returning_by_ref() {
assert_ast(
"<?php static fn &() => 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();