File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -74,11 +74,11 @@ mod tests {
74
74
75
75
let _token = limiter. try_acquire ( ) . await . unwrap ( ) ;
76
76
77
- let now = Instant :: now ( ) ;
77
+ let before_acquire = Instant :: now ( ) ;
78
78
let token = limiter. try_acquire ( ) . await ;
79
79
80
80
assert ! ( token. is_none( ) ) ;
81
- assert_elapsed ! ( now , delay, Duration :: from_millis( 10 ) ) ;
81
+ assert_elapsed ! ( before_acquire , delay, Duration :: from_millis( 10 ) ) ;
82
82
}
83
83
84
84
#[ tokio:: test]
@@ -89,13 +89,14 @@ mod tests {
89
89
90
90
let _token = limiter. try_acquire ( ) . await . unwrap ( ) ;
91
91
92
- let now = Instant :: now ( ) ;
92
+ let before_acquire = Instant :: now ( ) ;
93
93
let token = limiter. acquire_timeout ( Duration :: ZERO ) . await ;
94
94
95
95
assert ! ( token. is_none( ) ) ;
96
- assert_elapsed ! ( now , delay, Duration :: from_millis( 10 ) ) ;
96
+ assert_elapsed ! ( before_acquire , delay, Duration :: from_millis( 10 ) ) ;
97
97
}
98
98
99
+ /// Assert that a given duration has elapsed since `start`, within the given tolerance.
99
100
#[ macro_export]
100
101
#[ cfg( test) ]
101
102
macro_rules! assert_elapsed {
You can’t perform that action at this time.
0 commit comments