mirror of
https://github.com/danog/parser.git
synced 2024-11-27 04:14:55 +01:00
parser: add test with body for do/while
This commit is contained in:
parent
a897328b69
commit
22de6202e1
@ -3066,6 +3066,20 @@ mod tests {
|
||||
assert_ast("<?php do { } while ($a);", &[
|
||||
Statement::DoWhile { condition: Expression::Variable { name: "a".into() }, body: vec![] }
|
||||
]);
|
||||
|
||||
assert_ast("<?php
|
||||
do {
|
||||
echo 'Hi!';
|
||||
} while (true);
|
||||
", &[
|
||||
Statement::DoWhile {
|
||||
condition: Expression::Bool { value: true },
|
||||
body: vec![
|
||||
Statement::Echo { values: vec![
|
||||
Expression::ConstantString { value: "Hi!".into() }
|
||||
]}
|
||||
]
|
||||
}])
|
||||
}
|
||||
|
||||
fn assert_ast(source: &str, expected: &[Statement]) {
|
||||
|
Loading…
Reference in New Issue
Block a user