more tests for select + fixes

This commit is contained in:
pedrocarlo
2025-05-27 17:28:49 -03:00
parent 5b6ed60133
commit e0c2a09d71
3 changed files with 167 additions and 57 deletions

View File

@@ -35,6 +35,22 @@ mod tests {
);
}
};
($test_name:ident, $input:literal, $($attribute:meta),*) => {
#[test]
$(#[$attribute])*
fn $test_name() {
let context = crate::to_sql_string::stmt::tests::TestContext;
let input: &str = $input;
let mut parser = crate::lexer::sql::Parser::new(input.as_bytes());
let cmd = fallible_iterator::FallibleIterator::next(&mut parser)
.unwrap()
.unwrap();
assert_eq!(
input,
crate::to_sql_string::ToSqlString::to_sql_string(cmd.stmt(), &context)
);
}
}
}
pub(crate) struct TestContext;