mirror of
https://github.com/danog/parser.git
synced 2025-01-22 21:11:55 +01:00
parser: add test for static closures returning by ref
This commit is contained in:
parent
95dbc4416e
commit
af11ff39c8
@ -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]) {
|
fn assert_ast(source: &str, expected: &[Statement]) {
|
||||||
let mut lexer = Lexer::new(None);
|
let mut lexer = Lexer::new(None);
|
||||||
let tokens = lexer.tokenize(source).unwrap();
|
let tokens = lexer.tokenize(source).unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user