parser: add test for static closures returning by ref

This commit is contained in:
Ryan Chandler 2022-09-15 00:46:13 +01:00
parent 95dbc4416e
commit af11ff39c8
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -3901,6 +3901,20 @@ mod tests {
]);
}
#[test]
fn static_closures_returning_by_ref() {
assert_ast("<?php static function &() {};", &[
expr!(Expression::Closure {
params: vec![],
body: vec![],
return_type: None,
r#static: true,
uses: vec![],
by_ref: true,
})
]);
}
fn assert_ast(source: &str, expected: &[Statement]) {
let mut lexer = Lexer::new(None);
let tokens = lexer.tokenize(source).unwrap();