Add more configuration tests
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user