Run go generate

Minor changes to generated test file because of c5b1da6 (#128).
This commit is contained in:
Suhas Karanth 2020-08-16 16:55:11 +05:30
parent 005b899ec8
commit 720d53e65d
2 changed files with 25 additions and 31 deletions

View File

@ -8,11 +8,6 @@ import (
"sync" "sync"
) )
var (
lockPersonStoreMockCreate sync.RWMutex
lockPersonStoreMockGet sync.RWMutex
)
// Ensure, that PersonStoreMock does implement PersonStore. // Ensure, that PersonStoreMock does implement PersonStore.
// If this is not the case, regenerate this file with moq. // If this is not the case, regenerate this file with moq.
var _ PersonStore = &PersonStoreMock{} var _ PersonStore = &PersonStoreMock{}
@ -61,6 +56,8 @@ type PersonStoreMock struct {
ID string ID string
} }
} }
lockCreate sync.RWMutex
lockGet sync.RWMutex
} }
// Create calls CreateFunc. // Create calls CreateFunc.
@ -77,9 +74,9 @@ func (mock *PersonStoreMock) Create(ctx context.Context, person *Person, confirm
Person: person, Person: person,
Confirm: confirm, Confirm: confirm,
} }
lockPersonStoreMockCreate.Lock() mock.lockCreate.Lock()
mock.calls.Create = append(mock.calls.Create, callInfo) mock.calls.Create = append(mock.calls.Create, callInfo)
lockPersonStoreMockCreate.Unlock() mock.lockCreate.Unlock()
return mock.CreateFunc(ctx, person, confirm) return mock.CreateFunc(ctx, person, confirm)
} }
@ -96,9 +93,9 @@ func (mock *PersonStoreMock) CreateCalls() []struct {
Person *Person Person *Person
Confirm bool Confirm bool
} }
lockPersonStoreMockCreate.RLock() mock.lockCreate.RLock()
calls = mock.calls.Create calls = mock.calls.Create
lockPersonStoreMockCreate.RUnlock() mock.lockCreate.RUnlock()
return calls return calls
} }
@ -114,9 +111,9 @@ func (mock *PersonStoreMock) Get(ctx context.Context, id string) (*Person, error
Ctx: ctx, Ctx: ctx,
ID: id, ID: id,
} }
lockPersonStoreMockGet.Lock() mock.lockGet.Lock()
mock.calls.Get = append(mock.calls.Get, callInfo) mock.calls.Get = append(mock.calls.Get, callInfo)
lockPersonStoreMockGet.Unlock() mock.lockGet.Unlock()
return mock.GetFunc(ctx, id) return mock.GetFunc(ctx, id)
} }
@ -131,8 +128,8 @@ func (mock *PersonStoreMock) GetCalls() []struct {
Ctx context.Context Ctx context.Context
ID string ID string
} }
lockPersonStoreMockGet.RLock() mock.lockGet.RLock()
calls = mock.calls.Get calls = mock.calls.Get
lockPersonStoreMockGet.RUnlock() mock.lockGet.RUnlock()
return calls return calls
} }

View File

@ -7,12 +7,6 @@ import (
"sync" "sync"
) )
var (
lockMyInterfaceMockOne sync.RWMutex
lockMyInterfaceMockThree sync.RWMutex
lockMyInterfaceMockTwo sync.RWMutex
)
// Ensure, that MyInterfaceMock does implement MyInterface. // Ensure, that MyInterfaceMock does implement MyInterface.
// If this is not the case, regenerate this file with moq. // If this is not the case, regenerate this file with moq.
var _ MyInterface = &MyInterfaceMock{} var _ MyInterface = &MyInterfaceMock{}
@ -60,6 +54,9 @@ type MyInterfaceMock struct {
Two []struct { Two []struct {
} }
} }
lockOne sync.RWMutex
lockThree sync.RWMutex
lockTwo sync.RWMutex
} }
// One calls OneFunc. // One calls OneFunc.
@ -69,9 +66,9 @@ func (mock *MyInterfaceMock) One() bool {
} }
callInfo := struct { callInfo := struct {
}{} }{}
lockMyInterfaceMockOne.Lock() mock.lockOne.Lock()
mock.calls.One = append(mock.calls.One, callInfo) mock.calls.One = append(mock.calls.One, callInfo)
lockMyInterfaceMockOne.Unlock() mock.lockOne.Unlock()
return mock.OneFunc() return mock.OneFunc()
} }
@ -82,9 +79,9 @@ func (mock *MyInterfaceMock) OneCalls() []struct {
} { } {
var calls []struct { var calls []struct {
} }
lockMyInterfaceMockOne.RLock() mock.lockOne.RLock()
calls = mock.calls.One calls = mock.calls.One
lockMyInterfaceMockOne.RUnlock() mock.lockOne.RUnlock()
return calls return calls
} }
@ -95,9 +92,9 @@ func (mock *MyInterfaceMock) Three() string {
} }
callInfo := struct { callInfo := struct {
}{} }{}
lockMyInterfaceMockThree.Lock() mock.lockThree.Lock()
mock.calls.Three = append(mock.calls.Three, callInfo) mock.calls.Three = append(mock.calls.Three, callInfo)
lockMyInterfaceMockThree.Unlock() mock.lockThree.Unlock()
return mock.ThreeFunc() return mock.ThreeFunc()
} }
@ -108,9 +105,9 @@ func (mock *MyInterfaceMock) ThreeCalls() []struct {
} { } {
var calls []struct { var calls []struct {
} }
lockMyInterfaceMockThree.RLock() mock.lockThree.RLock()
calls = mock.calls.Three calls = mock.calls.Three
lockMyInterfaceMockThree.RUnlock() mock.lockThree.RUnlock()
return calls return calls
} }
@ -121,9 +118,9 @@ func (mock *MyInterfaceMock) Two() int {
} }
callInfo := struct { callInfo := struct {
}{} }{}
lockMyInterfaceMockTwo.Lock() mock.lockTwo.Lock()
mock.calls.Two = append(mock.calls.Two, callInfo) mock.calls.Two = append(mock.calls.Two, callInfo)
lockMyInterfaceMockTwo.Unlock() mock.lockTwo.Unlock()
return mock.TwoFunc() return mock.TwoFunc()
} }
@ -134,8 +131,8 @@ func (mock *MyInterfaceMock) TwoCalls() []struct {
} { } {
var calls []struct { var calls []struct {
} }
lockMyInterfaceMockTwo.RLock() mock.lockTwo.RLock()
calls = mock.calls.Two calls = mock.calls.Two
lockMyInterfaceMockTwo.RUnlock() mock.lockTwo.RUnlock()
return calls return calls
} }