Only support escape literals for Postgres, Redshift and generic dialect (#1674)

This commit is contained in:
Hans Ott 2025-01-24 09:02:53 +01:00 committed by GitHub
parent 4f7154288e
commit ef072be9e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 69 additions and 2 deletions

View file

@ -240,13 +240,17 @@ impl TestedDialects {
/// Check that the tokenizer returns the expected tokens for the given SQL.
pub fn tokenizes_to(&self, sql: &str, expected: Vec<Token>) {
if self.dialects.is_empty() {
panic!("No dialects to test");
}
self.dialects.iter().for_each(|dialect| {
let mut tokenizer = Tokenizer::new(&**dialect, sql);
if let Some(options) = &self.options {
tokenizer = tokenizer.with_unescape(options.unescape);
}
let tokens = tokenizer.tokenize().unwrap();
assert_eq!(expected, tokens);
assert_eq!(expected, tokens, "Tokenized differently for {:?}", dialect);
});
}
}