diff --git a/src/parser.rs b/src/parser.rs index 4735fb8..09a4fdb 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -276,12 +276,12 @@ mod tests { use super::*; macro_rules! parsetest { - ($input:expr, $output:pat) => { + ($input:expr, $output:pat, $ifexpr:expr) => { { let tokens = tokenizer::tokenize($input).unwrap(); let ast = parse(&tokens, &[]).unwrap(); match &ast[..] { - $output => (), + $output if $ifexpr => (), x => panic!("Error in parse test, got {:?} instead", x) } } @@ -290,7 +290,7 @@ mod tests { #[test] fn parse_test() { - parsetest!("a", [ASTNode::ExprNode(Expression::Variable("a"))]); + parsetest!("a", [ASTNode::ExprNode(Expression::Variable(ref s))], s == "a"); } }