parser/tests: group use with alias

This commit is contained in:
Ryan Chandler 2022-11-28 13:13:38 +00:00
parent a99b62155a
commit e7d4900a02

View File

@ -5341,6 +5341,17 @@ mod tests {
]); ]);
} }
#[test]
fn simple_group_use_with_alias() {
assert_ast("<?php use Foo\\{Bar, Baz as Bob, Car};", &[
Statement::GroupUse { prefix: "Foo\\".into(), kind: crate::UseKind::Normal, uses: vec![
Use { name: "Bar".into(), alias: None },
Use { name: "Baz".into(), alias: Some("Bob".into()) },
Use { name: "Car".into(), alias: None }
]}
]);
}
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();