mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 10:47:22 +00:00
Support unary + / -
This commit is contained in:
parent
786b1cf18a
commit
54c9ca8619
2 changed files with 30 additions and 1 deletions
|
@ -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::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue