Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbings committed Jul 18, 2024
1 parent 4cad380 commit a68048b
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions src/find/matchers/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ mod tests {

let mut deps = FakeDependencies::new();
let files_mtime = file.metadata().unwrap().modified().unwrap();
let today_midnight = get_time(&mut deps.new_matcher_io(), true);

let exactly_one_day_matcher =
FileTimeMatcher::new(FileTimeType::Modified, ComparableValue::EqualTo(1), true);
Expand Down Expand Up @@ -574,27 +573,6 @@ mod tests {
"3 day old file shouldn't match exactly 0 days old"
);

// set "now" to 1 day after the file was modified.
// `today_midnight` is used here to ensure that the time is one day later and
// not more after adding `3 * SECONDS_PER_DAY / 2`.
deps.set_time(today_midnight + Duration::new((3 * SECONDS_PER_DAY / 2) as u64, 0));
assert!(
!exactly_one_day_matcher.matches(&file, &mut deps.new_matcher_io()),
"1 day old file should't match exactly 1 day old"
);
assert!(
more_than_one_day_matcher.matches(&file, &mut deps.new_matcher_io()),
"1 day old file shouldn't match more than 1 day old"
);
assert!(
!less_than_one_day_matcher.matches(&file, &mut deps.new_matcher_io()),
"1 day old file should match less than 1 day old"
);
assert!(
!zero_day_matcher.matches(&file, &mut deps.new_matcher_io()),
"1 day old file should match exactly 0 days old"
);

// set "now" to exactly the same time file was modified.
deps.set_time(files_mtime);
assert!(
Expand Down

0 comments on commit a68048b

Please sign in to comment.