Skip to content

Commit

Permalink
Use TryFrom in tests for TimeSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
sirhcel committed Oct 20, 2024
1 parent 077d6d2 commit 404aa68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/sys/test_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ pub fn test_timespec() {
}

#[test]
pub fn test_timespec_from() {
pub fn test_timespec_try_from() {
let duration = Duration::new(123, 123_456_789);
let timespec = TimeSpec::nanoseconds(123_123_456_789);

assert_eq!(TimeSpec::from(duration), timespec);
assert_eq!(Duration::from(timespec), duration);
assert_eq!(TimeSpec::try_from(duration).unwrap(), timespec);
assert_eq!(Duration::try_from(timespec).unwrap(), duration);
}

#[test]
Expand Down

0 comments on commit 404aa68

Please sign in to comment.