Skip to content

Commit

Permalink
Remove fully qualified import for asset_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavcloud committed Dec 5, 2024
1 parent 903b248 commit 61199fe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4066,8 +4066,8 @@ fn test_alter_table_with_on_cluster() {
Statement::AlterTable {
name, on_cluster, ..
} => {
std::assert_eq!(name.to_string(), "t");
std::assert_eq!(on_cluster, Some(Ident::with_quote('\'', "cluster")));
assert_eq!(name.to_string(), "t");
assert_eq!(on_cluster, Some(Ident::with_quote('\'', "cluster")));
}
_ => unreachable!(),
}
Expand All @@ -4078,15 +4078,15 @@ fn test_alter_table_with_on_cluster() {
Statement::AlterTable {
name, on_cluster, ..
} => {
std::assert_eq!(name.to_string(), "t");
std::assert_eq!(on_cluster, Some(Ident::new("cluster_name")));
assert_eq!(name.to_string(), "t");
assert_eq!(on_cluster, Some(Ident::new("cluster_name")));
}
_ => unreachable!(),
}

let res = all_dialects()
.parse_sql_statements("ALTER TABLE t ON CLUSTER 123 ADD CONSTRAINT bar PRIMARY KEY (baz)");
std::assert_eq!(
assert_eq!(
res.unwrap_err(),
ParserError::ParserError("Expected: identifier, found: 123".to_string())
)
Expand Down Expand Up @@ -11226,7 +11226,7 @@ fn test_group_by_nothing() {
let Select { group_by, .. } = all_dialects_where(|d| d.supports_group_by_expr())
.verified_only_select("SELECT count(1) FROM t GROUP BY ()");
{
std::assert_eq!(
assert_eq!(
GroupByExpr::Expressions(vec![Expr::Tuple(vec![])], vec![]),
group_by
);
Expand All @@ -11235,7 +11235,7 @@ fn test_group_by_nothing() {
let Select { group_by, .. } = all_dialects_where(|d| d.supports_group_by_expr())
.verified_only_select("SELECT name, count(1) FROM t GROUP BY name, ()");
{
std::assert_eq!(
assert_eq!(
GroupByExpr::Expressions(
vec![
Identifier(Ident::new("name".to_string())),
Expand Down
20 changes: 10 additions & 10 deletions tests/sqlparser_snowflake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2649,15 +2649,15 @@ fn parse_use() {
let quote_styles = ['\'', '"', '`'];
for object_name in &valid_object_names {
// Test single identifier without quotes
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE {}", object_name)),
Statement::Use(Use::Object(ObjectName(vec![Ident::new(
object_name.to_string()
)])))
);
for &quote in &quote_styles {
// Test single identifier with different type of quotes
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE {}{}{}", quote, object_name, quote)),
Statement::Use(Use::Object(ObjectName(vec![Ident::with_quote(
quote,
Expand All @@ -2669,7 +2669,7 @@ fn parse_use() {

for &quote in &quote_styles {
// Test double identifier with different type of quotes
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE {0}CATALOG{0}.{0}my_schema{0}", quote)),
Statement::Use(Use::Object(ObjectName(vec![
Ident::with_quote(quote, "CATALOG"),
Expand All @@ -2678,7 +2678,7 @@ fn parse_use() {
);
}
// Test double identifier without quotes
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt("USE mydb.my_schema"),
Statement::Use(Use::Object(ObjectName(vec![
Ident::new("mydb"),
Expand All @@ -2688,35 +2688,35 @@ fn parse_use() {

for &quote in &quote_styles {
// Test single and double identifier with keyword and different type of quotes
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE DATABASE {0}my_database{0}", quote)),
Statement::Use(Use::Database(ObjectName(vec![Ident::with_quote(
quote,
"my_database".to_string(),
)])))
);
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE SCHEMA {0}my_schema{0}", quote)),
Statement::Use(Use::Schema(ObjectName(vec![Ident::with_quote(
quote,
"my_schema".to_string(),
)])))
);
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE SCHEMA {0}CATALOG{0}.{0}my_schema{0}", quote)),
Statement::Use(Use::Schema(ObjectName(vec![
Ident::with_quote(quote, "CATALOG"),
Ident::with_quote(quote, "my_schema")
])))
);
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE ROLE {0}my_role{0}", quote)),
Statement::Use(Use::Role(ObjectName(vec![Ident::with_quote(
quote,
"my_role".to_string(),
)])))
);
std::assert_eq!(
assert_eq!(
snowflake().verified_stmt(&format!("USE WAREHOUSE {0}my_wh{0}", quote)),
Statement::Use(Use::Warehouse(ObjectName(vec![Ident::with_quote(
quote,
Expand All @@ -2728,7 +2728,7 @@ fn parse_use() {
// Test invalid syntax - missing identifier
let invalid_cases = ["USE SCHEMA", "USE DATABASE", "USE WAREHOUSE"];
for sql in &invalid_cases {
std::assert_eq!(
assert_eq!(
snowflake().parse_sql_statements(sql).unwrap_err(),
ParserError::ParserError("Expected: identifier, found: EOF".to_string()),
);
Expand Down

0 comments on commit 61199fe

Please sign in to comment.