Skip to content

Commit 3e34999

Browse files
committed
Merge tests to one
1 parent 60fbc9b commit 3e34999

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

tests/sqlparser_snowflake.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4583,8 +4583,8 @@ fn test_drop_constraints() {
45834583
}
45844584

45854585
#[test]
4586-
fn test_semantic_view_all_variants_should_pass() {
4587-
let test_cases = [
4586+
fn test_semantic_view() {
4587+
let valid_sqls = [
45884588
("SELECT * FROM SEMANTIC_VIEW(model)", None),
45894589
(
45904590
"SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1, dim2)",
@@ -4634,7 +4634,7 @@ fn test_semantic_view_all_variants_should_pass() {
46344634
),
46354635
];
46364636

4637-
for (input_sql, expected_sql) in test_cases {
4637+
for (input_sql, expected_sql) in valid_sqls {
46384638
if let Some(expected) = expected_sql {
46394639
// Test that non-canonical order gets normalized
46404640
let parsed = snowflake().parse_sql_statements(input_sql).unwrap();
@@ -4644,10 +4644,7 @@ fn test_semantic_view_all_variants_should_pass() {
46444644
snowflake().verified_stmt(input_sql);
46454645
}
46464646
}
4647-
}
46484647

4649-
#[test]
4650-
fn test_semantic_view_invalid_queries_should_fail() {
46514648
let invalid_sqls = [
46524649
"SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1 INVALID inv1)",
46534650
"SELECT * FROM SEMANTIC_VIEW(model DIMENSIONS dim1 DIMENSIONS dim2)",
@@ -4658,18 +4655,15 @@ fn test_semantic_view_invalid_queries_should_fail() {
46584655
let result = snowflake().parse_sql_statements(sql);
46594656
assert!(result.is_err(), "Expected error for invalid SQL: {}", sql);
46604657
}
4661-
}
46624658

4663-
#[test]
4664-
fn test_semantic_view_ast_structure() {
4665-
let sql = r#"SELECT * FROM SEMANTIC_VIEW(
4659+
let ast_sql = r#"SELECT * FROM SEMANTIC_VIEW(
46664660
my_model
46674661
DIMENSIONS DATE_PART('year', date_col), region_name
46684662
METRICS orders.revenue, orders.count
46694663
WHERE active = true
46704664
) AS model_alias"#;
46714665

4672-
let stmt = snowflake().parse_sql_statements(sql).unwrap();
4666+
let stmt = snowflake().parse_sql_statements(ast_sql).unwrap();
46734667
match &stmt[0] {
46744668
Statement::Query(q) => {
46754669
if let SetExpr::Select(select) = q.body.as_ref() {

0 commit comments

Comments
 (0)