mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 03:07:20 +00:00
Implement Spanned
to retrieve source locations on AST nodes (#1435)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
0adec33b94
commit
3c8fd74804
18 changed files with 3092 additions and 399 deletions
|
@ -18,6 +18,7 @@
|
|||
#[macro_use]
|
||||
mod test_utils;
|
||||
|
||||
use sqlparser::tokenizer::Span;
|
||||
use test_utils::*;
|
||||
|
||||
use sqlparser::ast::*;
|
||||
|
@ -31,7 +32,8 @@ fn test_square_brackets_over_db_schema_table_name() {
|
|||
select.projection[0],
|
||||
SelectItem::UnnamedExpr(Expr::Identifier(Ident {
|
||||
value: "col1".to_string(),
|
||||
quote_style: Some('[')
|
||||
quote_style: Some('['),
|
||||
span: Span::empty(),
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -41,11 +43,13 @@ fn test_square_brackets_over_db_schema_table_name() {
|
|||
name: ObjectName(vec![
|
||||
Ident {
|
||||
value: "test_schema".to_string(),
|
||||
quote_style: Some('[')
|
||||
quote_style: Some('['),
|
||||
span: Span::empty(),
|
||||
},
|
||||
Ident {
|
||||
value: "test_table".to_string(),
|
||||
quote_style: Some('[')
|
||||
quote_style: Some('['),
|
||||
span: Span::empty(),
|
||||
}
|
||||
]),
|
||||
alias: None,
|
||||
|
@ -79,7 +83,8 @@ fn test_double_quotes_over_db_schema_table_name() {
|
|||
select.projection[0],
|
||||
SelectItem::UnnamedExpr(Expr::Identifier(Ident {
|
||||
value: "col1".to_string(),
|
||||
quote_style: Some('"')
|
||||
quote_style: Some('"'),
|
||||
span: Span::empty(),
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
|
@ -89,11 +94,13 @@ fn test_double_quotes_over_db_schema_table_name() {
|
|||
name: ObjectName(vec![
|
||||
Ident {
|
||||
value: "test_schema".to_string(),
|
||||
quote_style: Some('"')
|
||||
quote_style: Some('"'),
|
||||
span: Span::empty(),
|
||||
},
|
||||
Ident {
|
||||
value: "test_table".to_string(),
|
||||
quote_style: Some('"')
|
||||
quote_style: Some('"'),
|
||||
span: Span::empty(),
|
||||
}
|
||||
]),
|
||||
alias: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue