test(parser::ast_builder): fix
This commit is contained in:
parent
258a4189c0
commit
a3fc212283
|
@ -393,17 +393,18 @@ mod tests {
|
||||||
assert_eq!(build_ast(tokens), results);
|
assert_eq!(build_ast(tokens), results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
fn negative_parenthesis() {
|
fn negative_parenthesis() {
|
||||||
let tokens = vec![minus(), one_token(), times(), open(), one_token(), close()];
|
let tokens = vec![minus(), one_token(), times(), open(), minus(), one_token(), close()];
|
||||||
let results = Node::Binary {
|
let results = Node::Unary {
|
||||||
operator: times(),
|
|
||||||
lhs: Box::new(Node::Unary {
|
|
||||||
operator: minus(),
|
operator: minus(),
|
||||||
operand: Box::new(Node::Leaf(vec![one()])),
|
operand: Box::new(Node::Binary {
|
||||||
}),
|
operator: times(),
|
||||||
|
lhs: Box::new(Node::Leaf(vec![one()])),
|
||||||
rhs: Box::new(Node::Unary {
|
rhs: Box::new(Node::Unary {
|
||||||
operator: minus(),
|
operator: minus(),
|
||||||
operand: Box::new(Node::Leaf(vec![one()])),
|
operand: Box::new(Node::Leaf(vec![one()])),
|
||||||
|
})
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
assert_eq!(build_ast(tokens), results);
|
assert_eq!(build_ast(tokens), results);
|
||||||
|
|
Loading…
Reference in New Issue