From 7b11e7dabbcaa61c1250451e91367ceacecc9ed4 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 7 Oct 2016 18:46:50 +0200 Subject: [PATCH] Add testing implementation for Drop for FileLockEntry --- libimagstore/src/store.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 4172b4b2..a423a059 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -879,6 +879,7 @@ impl<'a> DerefMut for FileLockEntry<'a> { } } +#[cfg(not(test))] impl<'a> Drop for FileLockEntry<'a> { /// This will silently ignore errors, use `Store::update` if you want to catch the errors fn drop(&mut self) { @@ -886,6 +887,15 @@ impl<'a> Drop for FileLockEntry<'a> { } } +#[cfg(test)] +impl<'a> Drop for FileLockEntry<'a> { + /// This will not silently ignore errors but prints the result of the _update() call for testing + fn drop(&mut self) { + println!("Drop Result: {:?}", self.store._update(self)); + } +} + + /// `EntryContent` type pub type EntryContent = String;