From 17f9846bb973b98cdb3f180fe85491d9de0a5376 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 28 Dec 2016 19:46:06 -0800 Subject: [PATCH] Make tests pass w/ new match syntax --- src/parser.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 5fd93d4..90ba0f1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -355,16 +355,16 @@ mod tests { parsetest!( "fn a() 1 + 2 end", - [FuncNode(Function {prototype: Prototype { name: ref name, args: ref args }, body: ref body})], - match &body[..] { [BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false } - && name == "a" && match &args[..] { [] => true, _ => false } + &[FuncNode(Function {prototype: Prototype { name: ref name, parameters: ref parameters }, body: ref body})], + match &body[..] { &[BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false } + && name == "a" && match ¶meters[..] { &[] => true, _ => false } ); parsetest!( "fn a(x,y) 1 + 2 end", - [FuncNode(Function {prototype: Prototype { name: ref name, args: ref args }, body: ref body})], - match &body[..] { [BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false } - && name == "a" && *args == ["x","y"] + &[FuncNode(Function {prototype: Prototype { name: ref name, parameters: ref parameters }, body: ref body})], + match &body[..] { &[BinExp(_, box Number(1.0), box Number(2.0))] => true, _ => false } + && name == "a" && *parameters == ["x","y"] ); } @@ -372,18 +372,18 @@ mod tests { fn expression_parse_test() { use super::ASTNode::*; use super::Expression::*; - parsetest!("a", [ExprNode(Variable(ref s))], s == "a"); + parsetest!("a", &[ExprNode(Variable(ref s))], s == "a"); parsetest!("a + b", - [ExprNode(BinExp(ref plus, box Variable(ref a), box Variable(ref b)))], + &[ExprNode(BinExp(ref plus, box Variable(ref a), box Variable(ref b)))], plus == "+" && a == "a" && b == "b"); parsetest!("a + b * c", - [ExprNode(BinExp(ref plus, box Variable(ref a), box BinExp(ref mul, box Variable(ref b), box Variable(ref c))))], + &[ExprNode(BinExp(ref plus, box Variable(ref a), box BinExp(ref mul, box Variable(ref b), box Variable(ref c))))], plus == "+" && mul == "*" && a == "a" && b == "b" && c == "c"); parsetest!("a * b + c", - [ExprNode(BinExp(ref plus, box BinExp(ref mul, box Variable(ref a), box Variable(ref b)), box Variable(ref c)))], + &[ExprNode(BinExp(ref plus, box BinExp(ref mul, box Variable(ref a), box Variable(ref b)), box Variable(ref c)))], plus == "+" && mul == "*" && a == "a" && b == "b" && c == "c"); parsetest!("(a + b) * c", - [ExprNode(BinExp(ref mul, box BinExp(ref plus, box Variable(ref a), box Variable(ref b)), box Variable(ref c)))], + &[ExprNode(BinExp(ref mul, box BinExp(ref plus, box Variable(ref a), box Variable(ref b)), box Variable(ref c)))], plus == "+" && mul == "*" && a == "a" && b == "b" && c == "c"); } }