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 {
664664
665665 #[ test]
666666 #[ should_panic]
667- fn instant_duration_panic ( ) {
667+ fn instant_duration_since_panic ( ) {
668668 let a = Instant :: now ( ) ;
669669 ( a - Duration :: new ( 1 , 0 ) ) . duration_since ( a) ;
670670 }
671671
672672 #[ 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 ) ) ) ;
677680 }
678681
679682 #[ test]
680- fn saturating_instant_duration_nopanic ( ) {
683+ fn instant_saturating_duration_since_nopanic ( ) {
681684 let a = Instant :: now ( ) ;
682685 let ret = ( a - Duration :: new ( 1 , 0 ) ) . saturating_duration_since ( a) ;
683686 assert_eq ! ( ret, Duration :: new( 0 , 0 ) ) ;
You can’t perform that action at this time.
0 commit comments