本文整理匯總了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)
}
}
}