Fix bugs, add propper tests
This commit is contained in:
212
old_tests/parser/loops.exp
Normal file
212
old_tests/parser/loops.exp
Normal file
@@ -0,0 +1,212 @@
|
||||
Program {
|
||||
ast: Block(
|
||||
[
|
||||
Expr(
|
||||
LocBox {
|
||||
inner: ForLoop {
|
||||
init: Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"i",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 0,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 8,
|
||||
},
|
||||
},
|
||||
),
|
||||
test: LocBox {
|
||||
inner: BinOp {
|
||||
typ: Lt,
|
||||
left: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"i",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 17,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 10,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 22,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 19,
|
||||
},
|
||||
},
|
||||
on_loop: LocBox {
|
||||
inner: BinOp {
|
||||
typ: AddEq,
|
||||
left: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"i",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 25,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 1,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 29,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 27,
|
||||
},
|
||||
},
|
||||
body: Block(
|
||||
[],
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 1,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
Expr(
|
||||
LocBox {
|
||||
inner: WhileLoop {
|
||||
test: LocBox {
|
||||
inner: BinOp {
|
||||
typ: Gt,
|
||||
left: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"i",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 2,
|
||||
col: 8,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 3,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 2,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 2,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
body: Block(
|
||||
[],
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 2,
|
||||
col: 6,
|
||||
},
|
||||
},
|
||||
),
|
||||
Expr(
|
||||
LocBox {
|
||||
inner: InfLoop {
|
||||
body: Block(
|
||||
[],
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/loops.mcl",
|
||||
line: 3,
|
||||
col: 5,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
structs: {},
|
||||
enums: {},
|
||||
types: {},
|
||||
functions: {},
|
||||
member_functions: {},
|
||||
}
|
||||
Reference in New Issue
Block a user