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