mirror of
https://github.com/Prominence/rshred.git
synced 2026-07-03 02:36:45 +03:00
Applied rustfmt.
This commit is contained in:
+10
-9
@@ -26,7 +26,10 @@ pub fn setup(data_type: TestDataType) -> EnvironmentDetails {
|
||||
EnvironmentDetails::single(tmp_file_path)
|
||||
}
|
||||
TestDataType::MultipleFiles(files) => {
|
||||
let files = files.iter().map(|file| format!("{}/{}", TEST_DIR, file)).collect::<Vec<String>>();
|
||||
let files = files
|
||||
.iter()
|
||||
.map(|file| format!("{}/{}", TEST_DIR, file))
|
||||
.collect::<Vec<String>>();
|
||||
for file in files.iter() {
|
||||
let path = std::path::Path::new(&file);
|
||||
let directory = path.parent().unwrap();
|
||||
@@ -65,13 +68,11 @@ pub fn cleanup(env_details: EnvironmentDetails) {
|
||||
std::fs::remove_file(&filename).unwrap();
|
||||
}
|
||||
}
|
||||
EnvironmentDetails::Multiple(files) => {
|
||||
files.iter().for_each(|file| {
|
||||
if std::path::Path::new(file).exists() {
|
||||
std::fs::remove_file(file).unwrap();
|
||||
}
|
||||
})
|
||||
}
|
||||
EnvironmentDetails::Multiple(files) => files.iter().for_each(|file| {
|
||||
if std::path::Path::new(file).exists() {
|
||||
std::fs::remove_file(file).unwrap();
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,4 +93,4 @@ impl EnvironmentDetails {
|
||||
pub enum TestDataType {
|
||||
RandomSingleFile,
|
||||
MultipleFiles(Vec<String>),
|
||||
}
|
||||
}
|
||||
|
||||
+13
-15
@@ -57,21 +57,19 @@ fn shredding_with_file_deletion() {
|
||||
#[test]
|
||||
#[timeout(10000)]
|
||||
fn shredding_directory_recursively() {
|
||||
let env_details = common::setup(common::TestDataType::MultipleFiles(
|
||||
vec![
|
||||
String::from("test3/subdir1/1.txt"),
|
||||
String::from("test3/subdir1/2.txt"),
|
||||
String::from("test3/subdir1/3.txt"),
|
||||
String::from("test3/subdir1/subdir11/1.txt"),
|
||||
String::from("test3/subdir1/subdir11/2.txt"),
|
||||
String::from("test3/subdir2/subdir1/111.txt"),
|
||||
String::from("test3/subdir3/1231.txt"),
|
||||
String::from("test3/subdir3/1222.txt"),
|
||||
String::from("test3/subdir3/1286.txt"),
|
||||
String::from("test3/subdir3/1286/anotherdir/abs.txt"),
|
||||
String::from("test3/subdir3/1286/anotherdir/abc.txt"),
|
||||
]
|
||||
));
|
||||
let env_details = common::setup(common::TestDataType::MultipleFiles(vec![
|
||||
String::from("test3/subdir1/1.txt"),
|
||||
String::from("test3/subdir1/2.txt"),
|
||||
String::from("test3/subdir1/3.txt"),
|
||||
String::from("test3/subdir1/subdir11/1.txt"),
|
||||
String::from("test3/subdir1/subdir11/2.txt"),
|
||||
String::from("test3/subdir2/subdir1/111.txt"),
|
||||
String::from("test3/subdir3/1231.txt"),
|
||||
String::from("test3/subdir3/1222.txt"),
|
||||
String::from("test3/subdir3/1286.txt"),
|
||||
String::from("test3/subdir3/1286/anotherdir/abs.txt"),
|
||||
String::from("test3/subdir3/1286/anotherdir/abc.txt"),
|
||||
]));
|
||||
|
||||
match &env_details {
|
||||
common::EnvironmentDetails::Single(_) => {
|
||||
|
||||
Reference in New Issue
Block a user