code formatting
This commit is contained in:
parent
1589e358cf
commit
c05f718ebf
2
lib.go
2
lib.go
@ -16,7 +16,7 @@ type Clock interface {
|
|||||||
|
|
||||||
// TestClock is a test implementation of the Clock interface. On top of the Clock methods, it adds the
|
// TestClock is a test implementation of the Clock interface. On top of the Clock methods, it adds the
|
||||||
// possibility to manually step time or to virtually jump to a specified time.
|
// possibility to manually step time or to virtually jump to a specified time.
|
||||||
type TestClock struct{
|
type TestClock struct {
|
||||||
clock test
|
clock test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package times_test
|
package times_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"code.squareroundforest.org/arpio/times"
|
"code.squareroundforest.org/arpio/times"
|
||||||
"time"
|
|
||||||
"sort"
|
"sort"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSys(t *testing.T) {
|
func TestSys(t *testing.T) {
|
||||||
@ -212,7 +212,7 @@ func TestTest(t *testing.T) {
|
|||||||
|
|
||||||
var a []<-chan time.Time
|
var a []<-chan time.Time
|
||||||
for _, d := range initOrder {
|
for _, d := range initOrder {
|
||||||
a = append(a, c.After(d * time.Millisecond))
|
a = append(a, c.After(d*time.Millisecond))
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(a, func(i, j int) bool { return initOrder[i] < initOrder[j] })
|
sort.Slice(a, func(i, j int) bool { return initOrder[i] < initOrder[j] })
|
||||||
|
|||||||
2
sys.go
2
sys.go
@ -2,7 +2,7 @@ package times
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type sys struct {}
|
type sys struct{}
|
||||||
|
|
||||||
func (sys) Now() time.Time {
|
func (sys) Now() time.Time {
|
||||||
return time.Now()
|
return time.Now()
|
||||||
|
|||||||
8
test.go
8
test.go
@ -1,13 +1,13 @@
|
|||||||
package times
|
package times
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
"sort"
|
"sort"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type clockState struct {
|
type clockState struct {
|
||||||
current time.Time
|
current time.Time
|
||||||
chans map[time.Time][]chan<- time.Time
|
chans map[time.Time][]chan<- time.Time
|
||||||
chantlist []time.Time
|
chantlist []time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ func makeTestClock(initial time.Time) test {
|
|||||||
s := make(chan clockState, 1)
|
s := make(chan clockState, 1)
|
||||||
s <- clockState{
|
s <- clockState{
|
||||||
current: initial,
|
current: initial,
|
||||||
chans: make(map[time.Time][]chan<- time.Time),
|
chans: make(map[time.Time][]chan<- time.Time),
|
||||||
}
|
}
|
||||||
|
|
||||||
return test{state: s}
|
return test{state: s}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user