This commit is contained in:
Stephen Chung
2020-11-20 22:23:37 +08:00
parent b34e7840b0
commit 6069a4cf55
10 changed files with 173 additions and 78 deletions

View File

@@ -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(())
}