1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

Merge pull request #7755 from lavafroth/date-test-abs-diff

refactor(tests): use absolute difference of dates to check if they are within a window
This commit is contained in:
Himadri Bhattacharjee 2025-04-14 07:43:14 +00:00 committed by GitHub
parent c35d26dc51
commit 131ee87781
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -435,8 +435,7 @@ fn test_negative_offset() {
// Is the resulting date roughly what is expected?
let expected_date = Utc::now() - offset;
date > expected_date - Duration::minutes(10)
&& date < expected_date + Duration::minutes(10)
(date.to_utc() - expected_date).abs() < Duration::minutes(10)
});
}
}