Skip to content

Commit cd553ed

Browse files
Place regression tests beside related syntax cases
1 parent 893deae commit cd553ed

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

‎tests/sqlparser_common.rs‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3906,6 +3906,28 @@ fn parse_agg_with_order_by() {
39063906
}
39073907
}
39083908

3909+
#[test]
3910+
fn parse_aggregate_order_by_with_empty_args() {
3911+
let dialects = all_dialects_where(|d| d.supports_aggregate_order_by_with_empty_args());
3912+
dialects.verified_stmt("SELECT count(ORDER BY a) FROM t");
3913+
dialects.verified_stmt("SELECT count(ORDER BY a ASC, b DESC) FROM t");
3914+
dialects.verified_stmt("SELECT count(ALL ORDER BY a) FROM t");
3915+
assert_eq!(
3916+
dialects.parse_sql_statements("SELECT count(DISTINCT ORDER BY a) FROM t"),
3917+
Err(ParserError::ParserError(
3918+
"Expected: ), found: BY".to_string()
3919+
))
3920+
);
3921+
3922+
assert_eq!(
3923+
all_dialects_where(|d| !d.supports_aggregate_order_by_with_empty_args())
3924+
.parse_sql_statements("SELECT count(ORDER BY a) FROM t"),
3925+
Err(ParserError::ParserError(
3926+
"Expected: ), found: BY".to_string()
3927+
))
3928+
);
3929+
}
3930+
39093931
#[test]
39103932
fn parse_window_rank_function() {
39113933
let supported_dialects = TestedDialects::new(vec![
@@ -21254,25 +21276,3 @@ fn parse_qualified_literal_prefix_requires_adjacent_period() {
2125421276
dialects.tokenizes_to(sql, vec![token]);
2125521277
}
2125621278
}
21257-
21258-
#[test]
21259-
fn parse_aggregate_order_by_with_empty_args() {
21260-
let dialects = all_dialects_where(|d| d.supports_aggregate_order_by_with_empty_args());
21261-
dialects.verified_stmt("SELECT count(ORDER BY a) FROM t");
21262-
dialects.verified_stmt("SELECT count(ORDER BY a ASC, b DESC) FROM t");
21263-
dialects.verified_stmt("SELECT count(ALL ORDER BY a) FROM t");
21264-
assert_eq!(
21265-
dialects.parse_sql_statements("SELECT count(DISTINCT ORDER BY a) FROM t"),
21266-
Err(ParserError::ParserError(
21267-
"Expected: ), found: BY".to_string()
21268-
))
21269-
);
21270-
21271-
assert_eq!(
21272-
all_dialects_where(|d| !d.supports_aggregate_order_by_with_empty_args())
21273-
.parse_sql_statements("SELECT count(ORDER BY a) FROM t"),
21274-
Err(ParserError::ParserError(
21275-
"Expected: ), found: BY".to_string()
21276-
))
21277-
);
21278-
}

0 commit comments

Comments
 (0)