Uncommenting simple Miner tests (#1571)

This commit is contained in:
Tomasz Drwięga
2016-07-09 11:23:06 +02:00
committed by Arkadiy Paronyan
parent 5fe14e172e
commit b304ce5838
7 changed files with 62 additions and 31 deletions

View File

@@ -19,9 +19,9 @@
extern crate rand;
pub mod random_path;
pub mod test_socket;
pub mod stop_guard;
mod random_path;
mod test_socket;
mod stop_guard;
pub use random_path::*;
pub use test_socket::*;

View File

@@ -74,6 +74,25 @@ impl Drop for RandomTempPath {
}
}
pub struct GuardedTempResult<T> {
pub result: Option<T>,
pub _temp: RandomTempPath
}
impl<T> GuardedTempResult<T> {
pub fn reference(&self) -> &T {
self.result.as_ref().unwrap()
}
pub fn reference_mut(&mut self) -> &mut T {
self.result.as_mut().unwrap()
}
pub fn take(&mut self) -> T {
self.result.take().unwrap()
}
}
#[test]
fn creates_dir() {
let temp = RandomTempPath::create_dir();