mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-04 13:10:31 +00:00
fix parsing of identifiers after %
symbol (#927)
This commit is contained in:
parent
e36b34d8cc
commit
3a412152b9
3 changed files with 48 additions and 8 deletions
|
@ -116,6 +116,16 @@ impl TestedDialects {
|
|||
only_statement
|
||||
}
|
||||
|
||||
/// Ensures that `sql` parses as an [`Expr`], and that
|
||||
/// re-serializing the parse result produces canonical
|
||||
pub fn expr_parses_to(&self, sql: &str, canonical: &str) -> Expr {
|
||||
let ast = self
|
||||
.run_parser_method(sql, |parser| parser.parse_expr())
|
||||
.unwrap();
|
||||
assert_eq!(canonical, &ast.to_string());
|
||||
ast
|
||||
}
|
||||
|
||||
/// Ensures that `sql` parses as a single [Statement], and that
|
||||
/// re-serializing the parse result produces the same `sql`
|
||||
/// string (is not modified after a serialization round-trip).
|
||||
|
@ -147,11 +157,7 @@ impl TestedDialects {
|
|||
/// re-serializing the parse result produces the same `sql`
|
||||
/// string (is not modified after a serialization round-trip).
|
||||
pub fn verified_expr(&self, sql: &str) -> Expr {
|
||||
let ast = self
|
||||
.run_parser_method(sql, |parser| parser.parse_expr())
|
||||
.unwrap();
|
||||
assert_eq!(sql, &ast.to_string(), "round-tripping without changes");
|
||||
ast
|
||||
self.expr_parses_to(sql, sql)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue