datafusion-sqlparse/tests/sqlparser_ansi.rs
Nickolay Ponomarev dee30aabe0 Fix the clippy assert!(false) lint
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants

While I don't feel it's valid, fixing it lets us act on the other, more
useful, lints.
2019-04-21 04:46:19 +03:00

19 lines
577 B
Rust

use sqlparser::dialect::AnsiSqlDialect;
use sqlparser::sqlast::*;
use sqlparser::sqlparser::*;
#[test]
fn parse_simple_select() {
let sql = String::from("SELECT id, fname, lname FROM customer WHERE id = 1");
let ast = Parser::parse_sql(&AnsiSqlDialect {}, sql).unwrap();
assert_eq!(1, ast.len());
match ast.first().unwrap() {
SQLStatement::SQLSelect(SQLQuery {
body: SQLSetExpr::Select(SQLSelect { projection, .. }),
..
}) => {
assert_eq!(3, projection.len());
}
_ => unreachable!(),
}
}