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:
Mark-Oliver Junge 2024-11-26 17:22:30 +01:00 committed by GitHub
parent 0adec33b94
commit 3c8fd74804
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 3092 additions and 399 deletions

View file

@ -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,