Okay, this strategy makes the test work

This commit is contained in:
greg 2016-01-16 16:12:58 -08:00
parent b1163e2ae4
commit 252b6e8bd9

View File

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