Fix parsing of equality binop in function argument (#1182)

This commit is contained in:
Joey Hain 2024-04-06 10:08:40 -07:00 committed by GitHub
parent e976a2ee43
commit 3bf40485c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 64 additions and 18 deletions

View file

@ -68,7 +68,7 @@ impl TestedDialects {
}
Some((dialect, parsed))
})
.unwrap()
.expect("tested dialects cannot be empty")
.1
}
@ -195,15 +195,6 @@ impl TestedDialects {
/// Returns all available dialects.
pub fn all_dialects() -> TestedDialects {
all_dialects_except(|_| false)
}
/// Returns available dialects. The `except` predicate is used
/// to filter out specific dialects.
pub fn all_dialects_except<F>(except: F) -> TestedDialects
where
F: Fn(&dyn Dialect) -> bool,
{
let all_dialects = vec![
Box::new(GenericDialect {}) as Box<dyn Dialect>,
Box::new(PostgreSqlDialect {}) as Box<dyn Dialect>,
@ -218,14 +209,30 @@ where
Box::new(DuckDbDialect {}) as Box<dyn Dialect>,
];
TestedDialects {
dialects: all_dialects
.into_iter()
.filter(|d| !except(d.as_ref()))
.collect(),
dialects: all_dialects,
options: None,
}
}
/// Returns all dialects matching the given predicate.
pub fn all_dialects_where<F>(predicate: F) -> TestedDialects
where
F: Fn(&dyn Dialect) -> bool,
{
let mut dialects = all_dialects();
dialects.dialects.retain(|d| predicate(&**d));
dialects
}
/// Returns available dialects. The `except` predicate is used
/// to filter out specific dialects.
pub fn all_dialects_except<F>(except: F) -> TestedDialects
where
F: Fn(&dyn Dialect) -> bool,
{
all_dialects_where(|d| !except(d))
}
pub fn assert_eq_vec<T: ToString>(expected: &[&str], actual: &[T]) {
assert_eq!(
expected,