pub struct TestDatabase { /* private fields */ }Expand description
The database of a test, held in memory, every name being looked up regardless of its
case, as Databaseds does.
Besides answering the commands of the database device, it records them, see
Self::log, and can be made to fail some of them, see Self::add_fail, which
is what testing how a server or a client copes with its database takes.
Implementations§
Source§impl TestDatabase
impl TestDatabase
Sourcepub fn log(&self) -> Vec<(String, Value)>
pub fn log(&self) -> Vec<(String, Value)>
Every command answered so far, in order, with its argument, those that failed included.
Sourcepub fn add_fail(
&self,
name: &str,
err: impl Fn() -> Error + Send + Sync + 'static,
)
pub fn add_fail( &self, name: &str, err: impl Fn() -> Error + Send + Sync + 'static, )
Fail every command of that name from now on, with the error that makes, as a broken
database does, until Self::remove_fail.
Sourcepub fn remove_fail(&self, name: &str)
pub fn remove_fail(&self, name: &str)
Answer the commands of that name again, see Self::add_fail.
Trait Implementations§
Source§impl Debug for TestDatabase
impl Debug for TestDatabase
Auto Trait Implementations§
impl !Freeze for TestDatabase
impl RefUnwindSafe for TestDatabase
impl Send for TestDatabase
impl Sync for TestDatabase
impl Unpin for TestDatabase
impl UnsafeUnpin for TestDatabase
impl UnwindSafe for TestDatabase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more