Skip to content

Commit

Permalink
Use sets in the tests for expected and actual files to make those sta…
Browse files Browse the repository at this point in the history
…ble. (#1209)
  • Loading branch information
blob79 authored Feb 17, 2024
1 parent 378fa1f commit 9599ed5
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions czkawka_core/src/common_dir_traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum CheckingMethod {
AudioContent,
}

#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FileEntry {
pub path: PathBuf,
pub size: u64,
Expand Down Expand Up @@ -677,6 +677,7 @@ mod tests {
use super::*;
use crate::common_tool::*;
use once_cell::sync::Lazy;
use std::collections::HashSet;
use std::fs;
use std::fs::File;
use std::io;
Expand Down Expand Up @@ -725,9 +726,9 @@ mod tests {
warnings: _,
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!(
[
HashSet::from([
FileEntry {
path: src,
size: 1,
Expand All @@ -743,8 +744,7 @@ mod tests {
size: 1,
modified_date: secs,
},
]
.to_vec(),
]),
actual
);
}
Expand All @@ -771,9 +771,9 @@ mod tests {
warnings: _,
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!(
[
HashSet::from([
FileEntry {
path: src,
size: 1,
Expand All @@ -784,8 +784,7 @@ mod tests {
size: 1,
modified_date: secs,
},
]
.to_vec(),
]),
actual
);
}
Expand All @@ -812,9 +811,9 @@ mod tests {
warnings: _,
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!(
[
HashSet::from([
FileEntry {
path: src,
size: 1,
Expand All @@ -830,8 +829,7 @@ mod tests {
size: 1,
modified_date: secs,
},
]
.to_vec(),
]),
actual
);
}
Expand Down

0 comments on commit 9599ed5

Please sign in to comment.