Support unary + / -

This commit is contained in:
Nickolay Ponomarev 2019-02-11 02:30:07 +03:00
parent 786b1cf18a
commit 54c9ca8619
2 changed files with 30 additions and 1 deletions

View file

@ -174,6 +174,27 @@ fn parse_compound_expr_2() {
);
}
#[test]
fn parse_unary_math() {
use self::ASTNode::*;
use self::SQLOperator::*;
let sql = "- a + - b";
assert_eq!(
SQLBinaryExpr {
left: Box::new(SQLUnary {
operator: Minus,
expr: Box::new(SQLIdentifier("a".to_string())),
}),
op: Plus,
right: Box::new(SQLUnary {
operator: Minus,
expr: Box::new(SQLIdentifier("b".to_string())),
}),
},
verified_expr(sql)
);
}
#[test]
fn parse_is_null() {
use self::ASTNode::*;