do loop.
This commit is contained in:
@@ -24,3 +24,28 @@ fn test_while() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_do() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
|
||||
assert_eq!(
|
||||
engine.eval::<INT>(
|
||||
r"
|
||||
let x = 0;
|
||||
|
||||
do {
|
||||
x += 1;
|
||||
if x > 5 { break; }
|
||||
if x > 3 { continue; }
|
||||
x += 3;
|
||||
} while x < 10;
|
||||
|
||||
x
|
||||
",
|
||||
)?,
|
||||
6
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user