Test simplification
This commit is contained in:
parent
48343d3fad
commit
ad994c38ae
@ -444,14 +444,14 @@ mod tests {
|
|||||||
|
|
||||||
parsetest!(
|
parsetest!(
|
||||||
"fn a() 1 + 2 end",
|
"fn a() 1 + 2 end",
|
||||||
&[FuncNode(Function {prototype: Prototype { name: ref name, parameters: ref parameters }, body: ref body})],
|
&[FuncNode(Function {prototype: Prototype { ref name, ref parameters }, ref body})],
|
||||||
match &body[..] { &[BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false }
|
match &body[..] { &[BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false }
|
||||||
&& name == "a" && match ¶meters[..] { &[] => true, _ => false }
|
&& name == "a" && match ¶meters[..] { &[] => true, _ => false }
|
||||||
);
|
);
|
||||||
|
|
||||||
parsetest!(
|
parsetest!(
|
||||||
"fn a(x,y) 1 + 2 end",
|
"fn a(x,y) 1 + 2 end",
|
||||||
&[FuncNode(Function {prototype: Prototype { name: ref name, parameters: ref parameters }, body: ref body})],
|
&[FuncNode(Function {prototype: Prototype { ref name, ref parameters }, ref body})],
|
||||||
match &body[..] { &[BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false }
|
match &body[..] { &[BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false }
|
||||||
&& name == "a" && *parameters == ["x","y"]
|
&& name == "a" && *parameters == ["x","y"]
|
||||||
);
|
);
|
||||||
@ -485,11 +485,8 @@ mod tests {
|
|||||||
let t1 = "if null then 20 else 40 end";
|
let t1 = "if null then 20 else 40 end";
|
||||||
let tokens = tokenizer::tokenize(t1).unwrap();
|
let tokens = tokenizer::tokenize(t1).unwrap();
|
||||||
match parse(&tokens, &[]).unwrap()[..] {
|
match parse(&tokens, &[]).unwrap()[..] {
|
||||||
[ExprNode(Conditional(box Null, box ref a, Some(box ref b)))] => {
|
[ExprNode(Conditional(box Null, box Block(_), Some(box Block(_))))] => (),
|
||||||
// TODO make this test better
|
_ => panic!(),
|
||||||
|
|
||||||
}
|
|
||||||
_ => panic!("Bad conditional test"),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user