本文整理汇总了Golang中github.com/juju/testing.Clock.Alarms方法的典型用法代码示例。如果您正苦于以下问题:Golang Clock.Alarms方法的具体用法?Golang Clock.Alarms怎么用?Golang Clock.Alarms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/testing.Clock
的用法示例。
在下文中一共展示了Clock.Alarms方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: waitForClock
func waitForClock(c *gc.C, clock *testing.Clock) {
select {
case <-clock.Alarms():
case <-time.After(coretesting.LongWait):
c.Fatal("timed out waiting for clock")
}
}
示例2: waitAlarm
func waitAlarm(c *gc.C, clock *jujutesting.Clock) {
select {
case <-time.After(testing.LongWait):
c.Fatalf("alarm never set")
case <-clock.Alarms():
}
}
示例3: WaitAlarms
// WaitAlarms waits until the supplied clock has sent count values on
// its Alarms channel.
func WaitAlarms(c *gc.C, clock *testing.Clock, count int) {
timeout := time.After(jujutesting.LongWait)
for i := 0; i < count; i++ {
select {
case <-timeout:
c.Fatalf("never saw alarm %d", i)
case <-clock.Alarms():
}
}
}
示例4: waitAlarms
func waitAlarms(c *gc.C, clock *testing.Clock, count int) {
timeout := time.After(coretesting.LongWait)
for i := 0; i < count; i++ {
select {
case <-clock.Alarms():
case <-timeout:
c.Fatalf("timed out waiting for %dth alarm set", i)
}
}
}