Add more configuration tests

This commit is contained in:
2022-09-02 15:01:34 +02:00
parent a5e48cf9d0
commit 59aadeacd4
12 changed files with 463 additions and 97 deletions

View File

@@ -1,7 +1,17 @@
use mktemp::Temp;
use rand::Rng;
/// Create a temporary file and feed it with some specified content
pub fn create_temp_file_with_content(content: &[u8]) -> Temp {
let temp = Temp::new_file().unwrap();
std::fs::write(&temp, content).unwrap();
temp
}
/// Generate a temporary file with some random content
pub fn create_temp_file_with_random_content() -> Temp {
let random_bytes = rand::thread_rng().gen::<[u8; 10]>();
let temp = Temp::new_file().unwrap();
std::fs::write(&temp, random_bytes).unwrap();
temp
}