Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
chore: added test for Sleep method
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed Dec 27, 2021
1 parent edf377b commit 36f7399
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions time_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package neo

import (
"sync"
"testing"
"time"

Expand Down Expand Up @@ -245,3 +246,22 @@ func TestTime_ObserveTick(t *testing.T) {
}
}
}

func TestTime_Sleep(t *testing.T) {
const interval = time.Second

now := time.Date(2049, 5, 6, 23, 55, 11, 1034, time.UTC)
sim := NewTime(now)

observe := sim.Observe()

var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
sim.Sleep(interval)
}()
<-observe
sim.Travel(interval)
wg.Wait()
}

0 comments on commit 36f7399

Please sign in to comment.