File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1
1
# master
2
2
* Please add new entries at the top.*
3
3
4
+ 1 . ` TestScheduler ` can ` advance ` by ` TimeInterval ` . (#828 )
5
+
4
6
1 . Fixed spelling error in ` Token ` class documentation.
5
7
6
8
# 6.6.1
Original file line number Diff line number Diff line change @@ -563,6 +563,17 @@ public final class TestScheduler: DateScheduler {
563
563
lock. unlock ( )
564
564
}
565
565
566
+ /// Advances the virtualized clock by the given interval, dequeuing and
567
+ /// executing any actions along the way.
568
+ ///
569
+ /// - parameters:
570
+ /// - interval: Interval by which the current date will be advanced.
571
+ public func advance( by interval: TimeInterval ) {
572
+ lock. lock ( )
573
+ advance ( to: currentDate. addingTimeInterval ( interval) )
574
+ lock. unlock ( )
575
+ }
576
+
566
577
/// Advances the virtualized clock to the given future date, dequeuing and
567
578
/// executing any actions up until that point.
568
579
///
Original file line number Diff line number Diff line change @@ -355,6 +355,15 @@ class SchedulerSpec: QuickSpec {
355
355
expect ( scheduler. currentDate) == Date . distantFuture
356
356
expect ( string) == " fuzzbuzzfoobar "
357
357
}
358
+
359
+ it ( " should advance by DispatchTimeInterval same as by TimeInterval " ) {
360
+ let schedulerB = TestScheduler ( startDate: startDate)
361
+
362
+ scheduler. advance ( by: . milliseconds( 300 ) )
363
+ schedulerB. advance ( by: 0.3 )
364
+
365
+ expect ( scheduler. currentDate) . to ( equal ( schedulerB. currentDate) )
366
+ }
358
367
}
359
368
}
360
369
}
You can’t perform that action at this time.
0 commit comments