Skip to content

Commit

Permalink
feat: Compound test initiated
Browse files Browse the repository at this point in the history
  • Loading branch information
can-keklik committed Dec 25, 2023
1 parent 69d326c commit 5220547
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/src/lang/tests/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pub mod select_join;
pub mod select_limit;
pub mod select_order;
pub mod select_projection;
pub mod select_compound;
62 changes: 62 additions & 0 deletions server/src/lang/tests/sql/select_compound.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#[cfg(test)]
use crate::lang::tests::helpers::compare_parsed_to_expected;

#[cfg(test)]
use serde_json::json;

#[cfg(test)]
use crate::assert_parsing;

#[cfg(test)]
assert_parsing! {
single_union: {
"SELECT * FROM users UNION SELECT * FROM users;" => {
"type": "Stmt::Program",
"body": [
{
"type": "Stmt::Expression",
"expr": {
"type": "Expr::Select",
"value": {
"core": {
"from": {
"type": "Group",
"subqueries": [{
"type": "Collection",
"alias": null,
"name": "users",
"namespace": null,
}],
},
"projection": [{
"type": "All",
"collection": null
}]
},
"compound": [{
"operation": "Union",
"core": {
"from": {
"type": "Group",
"subqueries": [{
"type": "Collection",
"alias": null,
"name": "users",
"namespace": null,
}],
},
"projection": [{
"type": "All",
"collection": null
}]
},
}],
"limit": null,
"order_by": null
}
}
}
]
}
}
}

0 comments on commit 5220547

Please sign in to comment.