Add loop test
This commit is contained in:
parent
03b140189c
commit
c9295b5777
@ -377,7 +377,19 @@ else
|
|||||||
)];
|
)];
|
||||||
assert_eq!(deelang_parser::program(prgm).unwrap(), expected);
|
assert_eq!(deelang_parser::program(prgm).unwrap(), expected);
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn test_loop() {
|
||||||
|
let prgm = r"loop until i > 100 a";
|
||||||
|
let expected = vec![Stmt::Loop(Loop::Until(GuardedBlock {
|
||||||
|
guard: Expr::Relop(
|
||||||
|
">".to_string(),
|
||||||
|
Box::new(Expr::Id("i".to_string())),
|
||||||
|
Box::new(Expr::Atom(Atom::Num(100.0))),
|
||||||
|
),
|
||||||
|
block: vec![Stmt::BareExpr(Expr::Id("a".to_string()))],
|
||||||
|
}))];
|
||||||
|
assert_eq!(deelang_parser::program(prgm).unwrap(), expected);
|
||||||
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_preprocess() {
|
fn test_preprocess() {
|
||||||
let prgm = r"
|
let prgm = r"
|
||||||
|
Loading…
Reference in New Issue
Block a user