Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
refactor: rename tests_for_ds_impl, add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Joonas Koivunen committed Sep 4, 2020
1 parent 47dbad2 commit 11ab6dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/repo/common_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ impl<T: DataStore> std::ops::Deref for DSTestContext<T> {
}
}

/// Generates the "common interface" tests for PinStore implementations as a given module using a
/// types factory method. When adding tests, it might be easier to write them against the one
/// implementation and only then move them here; the compiler errors seem to point at the
/// `#[tokio::test]` attribute and the error needs to be guessed.
#[macro_export]
macro_rules! tests_for_ds_impl {
macro_rules! pinstore_interface_tests {
($module_name:ident, $factory:expr) => {
#[cfg(test)]
mod $module_name {
Expand Down
2 changes: 1 addition & 1 deletion src/repo/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ impl DataStore for FsDataStore {
}

#[cfg(test)]
crate::tests_for_ds_impl!(common_tests, crate::repo::fs::FsDataStore::new);
crate::pinstore_interface_tests!(common_tests, crate::repo::fs::FsDataStore::new);
2 changes: 1 addition & 1 deletion src/repo/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ pub enum PinUpdateError {
}

#[cfg(test)]
crate::tests_for_ds_impl!(common_tests, crate::repo::mem::MemDataStore::new);
crate::pinstore_interface_tests!(common_tests, crate::repo::mem::MemDataStore::new);

#[cfg(test)]
mod tests {
Expand Down

0 comments on commit 11ab6dc

Please sign in to comment.