File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -664,20 +664,23 @@ mod tests {
664
664
665
665
#[ test]
666
666
#[ should_panic]
667
- fn instant_duration_panic ( ) {
667
+ fn instant_duration_since_panic ( ) {
668
668
let a = Instant :: now ( ) ;
669
669
( a - Duration :: new ( 1 , 0 ) ) . duration_since ( a) ;
670
670
}
671
671
672
672
#[ test]
673
- fn checked_instant_duration_nopanic ( ) {
674
- let a = Instant :: now ( ) ;
675
- let ret = ( a - Duration :: new ( 1 , 0 ) ) . checked_duration_since ( a) ;
676
- assert_eq ! ( ret, None ) ;
673
+ fn instant_checked_duration_since_nopanic ( ) {
674
+ let now = Instant :: now ( ) ;
675
+ let earlier = now - Duration :: new ( 1 , 0 ) ;
676
+ let later = now + Duration :: new ( 1 , 0 ) ;
677
+ assert_eq ! ( earlier. checked_duration_since( now) , None ) ;
678
+ assert_eq ! ( later. checked_duration_since( now) , Some ( Duration :: new( 1 , 0 ) ) ) ;
679
+ assert_eq ! ( now. checked_duration_since( now) , Some ( Duration :: new( 0 , 0 ) ) ) ;
677
680
}
678
681
679
682
#[ test]
680
- fn saturating_instant_duration_nopanic ( ) {
683
+ fn instant_saturating_duration_since_nopanic ( ) {
681
684
let a = Instant :: now ( ) ;
682
685
let ret = ( a - Duration :: new ( 1 , 0 ) ) . saturating_duration_since ( a) ;
683
686
assert_eq ! ( ret, Duration :: new( 0 , 0 ) ) ;
You can’t perform that action at this time.
0 commit comments