Use sets in the tests for expected and actual files to make those stable. (#1209)
This commit is contained in:
parent
378fa1fd6e
commit
9599ed5377
|
@ -60,7 +60,7 @@ pub enum CheckingMethod {
|
||||||
AudioContent,
|
AudioContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub struct FileEntry {
|
pub struct FileEntry {
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
pub size: u64,
|
pub size: u64,
|
||||||
|
@ -677,6 +677,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::common_tool::*;
|
use crate::common_tool::*;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
use std::collections::HashSet;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
@ -725,9 +726,9 @@ mod tests {
|
||||||
warnings: _,
|
warnings: _,
|
||||||
grouped_file_entries,
|
grouped_file_entries,
|
||||||
} => {
|
} => {
|
||||||
let actual: Vec<_> = grouped_file_entries.into_values().flatten().collect();
|
let actual: HashSet<_> = grouped_file_entries.into_values().flatten().collect();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
[
|
HashSet::from([
|
||||||
FileEntry {
|
FileEntry {
|
||||||
path: src,
|
path: src,
|
||||||
size: 1,
|
size: 1,
|
||||||
|
@ -743,8 +744,7 @@ mod tests {
|
||||||
size: 1,
|
size: 1,
|
||||||
modified_date: secs,
|
modified_date: secs,
|
||||||
},
|
},
|
||||||
]
|
]),
|
||||||
.to_vec(),
|
|
||||||
actual
|
actual
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -771,9 +771,9 @@ mod tests {
|
||||||
warnings: _,
|
warnings: _,
|
||||||
grouped_file_entries,
|
grouped_file_entries,
|
||||||
} => {
|
} => {
|
||||||
let actual: Vec<_> = grouped_file_entries.into_iter().flat_map(take_1_per_inode).collect();
|
let actual: HashSet<_> = grouped_file_entries.into_iter().flat_map(take_1_per_inode).collect();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
[
|
HashSet::from([
|
||||||
FileEntry {
|
FileEntry {
|
||||||
path: src,
|
path: src,
|
||||||
size: 1,
|
size: 1,
|
||||||
|
@ -784,8 +784,7 @@ mod tests {
|
||||||
size: 1,
|
size: 1,
|
||||||
modified_date: secs,
|
modified_date: secs,
|
||||||
},
|
},
|
||||||
]
|
]),
|
||||||
.to_vec(),
|
|
||||||
actual
|
actual
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -812,9 +811,9 @@ mod tests {
|
||||||
warnings: _,
|
warnings: _,
|
||||||
grouped_file_entries,
|
grouped_file_entries,
|
||||||
} => {
|
} => {
|
||||||
let actual: Vec<_> = grouped_file_entries.into_iter().flat_map(take_1_per_inode).collect();
|
let actual: HashSet<_> = grouped_file_entries.into_iter().flat_map(take_1_per_inode).collect();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
[
|
HashSet::from([
|
||||||
FileEntry {
|
FileEntry {
|
||||||
path: src,
|
path: src,
|
||||||
size: 1,
|
size: 1,
|
||||||
|
@ -830,8 +829,7 @@ mod tests {
|
||||||
size: 1,
|
size: 1,
|
||||||
modified_date: secs,
|
modified_date: secs,
|
||||||
},
|
},
|
||||||
]
|
]),
|
||||||
.to_vec(),
|
|
||||||
actual
|
actual
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue