Skip to content

Commit

Permalink
Simplify TestScheduler.advance a bit. (pointfreeco#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw authored Jun 27, 2022
1 parent a5e8a45 commit 28e5d15
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Sources/CombineSchedulers/TestScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,17 @@ where SchedulerTimeType: Strideable, SchedulerTimeType.Stride: SchedulerTimeInte
self.scheduled.sort { ($0.date, $0.sequence) < ($1.date, $1.sequence) }

guard
let nextDate = self.scheduled.first?.date,
finalDate >= nextDate
let next = self.scheduled.first,
finalDate >= next.date
else {
self.now = finalDate
return
}

self.now = nextDate
self.now = next.date

while let (_, date, action) = self.scheduled.first, date == nextDate {
self.scheduled.removeFirst()
action()
}
self.scheduled.removeFirst()
next.action()
}
}

Expand Down

0 comments on commit 28e5d15

Please sign in to comment.