Simplify macro for running a test with both databases

This commit is contained in:
Max Brunsfeld 2023-08-20 14:25:19 -07:00 committed by Mikayla
parent 26c3312049
commit 29e43384f0
No known key found for this signature in database
2 changed files with 558 additions and 537 deletions

File diff suppressed because it is too large Load diff

View file

@ -91,6 +91,23 @@ impl TestDb {
}
}
#[macro_export]
macro_rules! test_both_dbs {
($test_name:ident, $postgres_test_name:ident, $sqlite_test_name:ident) => {
#[gpui::test]
async fn $postgres_test_name() {
let test_db = TestDb::postgres(Deterministic::new(0).build_background());
$test_name(test_db.db()).await;
}
#[gpui::test]
async fn $sqlite_test_name() {
let test_db = TestDb::sqlite(Deterministic::new(0).build_background());
$test_name(test_db.db()).await;
}
};
}
impl Drop for TestDb {
fn drop(&mut self) {
let db = self.db.take().unwrap();