[functional-tests] port some of the cache_check tests to Rust

This commit is contained in:
Joe Thornber
2020-08-07 14:30:00 +01:00
parent 4a0582bb5d
commit fa4ea3e2d9
21 changed files with 464 additions and 128 deletions

27
tests/common/test_dir.rs Normal file
View File

@@ -0,0 +1,27 @@
use anyhow::Result;
use std::path::{PathBuf};
use tempfile::{tempdir, TempDir};
//---------------------------------------
pub struct TestDir {
dir: TempDir,
file_count: usize,
}
impl TestDir {
pub fn new() -> Result<TestDir> {
let dir = tempdir()?;
Ok(TestDir { dir, file_count: 0 })
}
pub fn mk_path(&mut self, file: &str) -> PathBuf {
let mut p = PathBuf::new();
p.push(&self.dir);
p.push(PathBuf::from(format!("{:02}_{}", self.file_count, file)));
self.file_count += 1;
p
}
}
//---------------------------------------