Skip to content

Commit 2684527

Browse files
committed
add tests
1 parent 0077e2b commit 2684527

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/sqlparser_common.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,23 @@ fn parse_select_group_by() {
10391039
);
10401040
}
10411041

1042+
#[test]
1043+
fn parse_select_group_by_grouping_sets() {
1044+
let sql =
1045+
"SELECT brand, size, sum(sales) FROM items_sold GROUP BY size, GROUPING SETS ((brand), (size))";
1046+
let select = verified_only_select(sql);
1047+
assert_eq!(
1048+
vec![
1049+
Expr::Identifier(Ident::new("size")),
1050+
Expr::GroupingSets(vec![
1051+
vec![Expr::Identifier(Ident::new("brand"))],
1052+
vec![Expr::Identifier(Ident::new("size"))],
1053+
])
1054+
],
1055+
select.group_by
1056+
);
1057+
}
1058+
10421059
#[test]
10431060
fn parse_select_having() {
10441061
let sql = "SELECT foo FROM bar GROUP BY foo HAVING COUNT(*) > 1";

0 commit comments

Comments
 (0)