1
0

add waiting count

This commit is contained in:
Arpad Ryszka 2026-03-05 18:39:54 +01:00
parent 0bdc043a8a
commit 03e9105ce6
2 changed files with 14 additions and 0 deletions

5
lib.go
View File

@ -58,3 +58,8 @@ func (c TestClock) Pass(d time.Duration) {
func (c TestClock) Jump(t time.Time) {
c.clock.jump(t)
}
// Waiting tells how many channels are waiting set by After().
func (c TestClock) Waiting() int {
return c.clock.waiting()
}

View File

@ -100,3 +100,12 @@ func (t test) jump(to time.Time) {
s.current = to
s = triggerChans(s)
}
func (t test) waiting() int {
s := <-t.state
defer func() {
t.state <- s
}()
return len(s.chantlist)
}