本文整理汇总了Golang中router/test.TestApp类的典型用法代码示例。如果您正苦于以下问题:Golang TestApp类的具体用法?Golang TestApp怎么用?Golang TestApp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestApp类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: waitMsgReceived
func (s *RouterSuite) waitMsgReceived(a *test.TestApp, r bool, t time.Duration) bool {
i := time.Millisecond * 50
m := int(t / i)
for j := 0; j < m; j++ {
received := true
for _, v := range a.Urls() {
_, ok := s.router.registry.Lookup(v)
if ok != r {
received = false
break
}
}
if received {
return true
}
time.Sleep(i)
}
return false
}
示例2: waitMsgReceived
func (s *RouterSuite) waitMsgReceived(a *test.TestApp, r bool, t time.Duration) bool {
i := time.Millisecond * 50
m := int(t / i)
for j := 0; j < m; j++ {
received := true
for _, v := range a.Urls() {
ms := s.router.registry.Lookup(&http.Request{Host: string(v)})
status := (ms != nil)
if status != r {
received = false
break
}
}
if received {
return true
}
time.Sleep(i)
}
return false
}