Skip to content

Commit

Permalink
rework failing test to check for future commit dates
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteT committed Aug 8, 2024
1 parent 90557ad commit 6816f9a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/info/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,15 @@ mod tests {
}

#[test]
#[should_panic(
expected = "Achievement unlocked: time travel! Check your system clock and commit dates."
)]
fn should_panic_when_display_human_time_and_commit_date_in_the_future() {
fn handle_display_human_time_and_commit_date_in_the_future() {
let day = Duration::from_secs(60 * 60 * 24);
let current_time = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap();
let tomorrow = current_time + day;
let time = Time::new(tomorrow.as_secs() as gix::date::SecondsSinceUnixEpoch, 0);
format_time(time, false);
let result = format_time(time, false);
assert_eq!(result, "in a day");
}

#[test]
Expand Down

0 comments on commit 6816f9a

Please sign in to comment.