parser: add test case for multiple declares in same statement

This commit is contained in:
Ryan Chandler 2022-09-13 00:54:01 +01:00
parent a48258146d
commit bbfce83894
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -3377,6 +3377,24 @@ mod tests {
]);
}
#[test]
fn multiple_declares_in_single_statement() {
assert_ast("<?php declare(A='B', C='D');", &[
Statement::Declare {
declares: vec![
DeclareItem {
key: "A".into(),
value: Expression::ConstantString { value: "B".into() }
},
DeclareItem {
key: "C".into(),
value: Expression::ConstantString { value: "D".into() }
}
]
}
]);
}
fn assert_ast(source: &str, expected: &[Statement]) {
let mut lexer = Lexer::new(None);
let tokens = lexer.tokenize(source).unwrap();