fix: unary negation operator with operators: Mul, Div and Mod (#902)

This commit is contained in:
Igor Izvekov 2023-06-22 18:15:31 +03:00 committed by GitHub
parent f72b5a5d9b
commit 8877cbafa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 6 deletions

View file

@ -1074,7 +1074,7 @@ fn parse_compound_expr_2() {
}
#[test]
fn parse_unary_math() {
fn parse_unary_math_with_plus() {
use self::Expr::*;
let sql = "-a + -b";
assert_eq!(
@ -1093,6 +1093,26 @@ fn parse_unary_math() {
);
}
#[test]
fn parse_unary_math_with_multiply() {
use self::Expr::*;
let sql = "-a * -b";
assert_eq!(
BinaryOp {
left: Box::new(UnaryOp {
op: UnaryOperator::Minus,
expr: Box::new(Identifier(Ident::new("a"))),
}),
op: BinaryOperator::Multiply,
right: Box::new(UnaryOp {
op: UnaryOperator::Minus,
expr: Box::new(Identifier(Ident::new("b"))),
}),
},
verified_expr(sql)
);
}
#[test]
fn parse_is_null() {
use self::Expr::*;