1 Star 0 Fork 0

妥協/fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sleeper.go 1.77 KB
一键复制 编辑 原始数据 按行查看 历史
Jason Yellick 提交于 2019-09-09 11:07 . FAB-7559 Reimplement blocksprovider
// Code generated by counterfeiter. DO NOT EDIT.
package fake
import (
"sync"
"time"
)
type Sleeper struct {
SleepStub func(time.Duration)
sleepMutex sync.RWMutex
sleepArgsForCall []struct {
arg1 time.Duration
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *Sleeper) Sleep(arg1 time.Duration) {
fake.sleepMutex.Lock()
fake.sleepArgsForCall = append(fake.sleepArgsForCall, struct {
arg1 time.Duration
}{arg1})
fake.recordInvocation("Sleep", []interface{}{arg1})
fake.sleepMutex.Unlock()
if fake.SleepStub != nil {
fake.SleepStub(arg1)
}
}
func (fake *Sleeper) SleepCallCount() int {
fake.sleepMutex.RLock()
defer fake.sleepMutex.RUnlock()
return len(fake.sleepArgsForCall)
}
func (fake *Sleeper) SleepCalls(stub func(time.Duration)) {
fake.sleepMutex.Lock()
defer fake.sleepMutex.Unlock()
fake.SleepStub = stub
}
func (fake *Sleeper) SleepArgsForCall(i int) time.Duration {
fake.sleepMutex.RLock()
defer fake.sleepMutex.RUnlock()
argsForCall := fake.sleepArgsForCall[i]
return argsForCall.arg1
}
func (fake *Sleeper) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.sleepMutex.RLock()
defer fake.sleepMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *Sleeper) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liurenhao/fabric.git
git@gitee.com:liurenhao/fabric.git
liurenhao
fabric
fabric
v2.1.1

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385