Skip to content

Commit 3497195

Browse files
committed
Added unit test for wait_till_completed
1 parent 9eb2056 commit 3497195

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ticked_async_executor.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ where
6464
pub fn tick_channel(&self) -> tokio::sync::watch::Receiver<f64> {
6565
self.spawner.tick_channel()
6666
}
67+
68+
pub fn wait_till_completed(&self, delta: f64) {
69+
self.ticker.wait_till_completed(delta);
70+
}
6771
}
6872

6973
#[cfg(test)]
@@ -136,9 +140,7 @@ mod tests {
136140
assert_eq!(executor.num_tasks(), 3);
137141

138142
// Since we have cancelled the tasks above, the loops should eventually end
139-
while executor.num_tasks() != 0 {
140-
executor.tick(DELTA, None);
141-
}
143+
executor.wait_till_completed(DELTA);
142144
}
143145

144146
#[test]

0 commit comments

Comments
 (0)