Go fmt
This commit is contained in:
parent
d6bc24ab27
commit
941b573418
@ -4,13 +4,13 @@ package example
|
|||||||
// github.com/matryer/moq
|
// github.com/matryer/moq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
|
||||||
"context"
|
"context"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lockPersonStoreMockCreate sync.RWMutex
|
lockPersonStoreMockCreate sync.RWMutex
|
||||||
lockPersonStoreMockGet sync.RWMutex
|
lockPersonStoreMockGet sync.RWMutex
|
||||||
)
|
)
|
||||||
|
|
||||||
// PersonStoreMock is a mock implementation of PersonStore.
|
// PersonStoreMock is a mock implementation of PersonStore.
|
||||||
@ -18,7 +18,7 @@ var (
|
|||||||
// func TestSomethingThatUsesPersonStore(t *testing.T) {
|
// func TestSomethingThatUsesPersonStore(t *testing.T) {
|
||||||
//
|
//
|
||||||
// // make and configure a mocked PersonStore
|
// // make and configure a mocked PersonStore
|
||||||
// mockedPersonStore := &PersonStoreMock{
|
// mockedPersonStore := &PersonStoreMock{
|
||||||
// CreateFunc: func(ctx context.Context, person *Person, confirm bool) error {
|
// CreateFunc: func(ctx context.Context, person *Person, confirm bool) error {
|
||||||
// panic("TODO: mock out the Create method")
|
// panic("TODO: mock out the Create method")
|
||||||
// },
|
// },
|
||||||
@ -29,7 +29,7 @@ var (
|
|||||||
//
|
//
|
||||||
// // TODO: use mockedPersonStore in code that requires PersonStore
|
// // TODO: use mockedPersonStore in code that requires PersonStore
|
||||||
// // and then make assertions.
|
// // and then make assertions.
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
type PersonStoreMock struct {
|
type PersonStoreMock struct {
|
||||||
// CreateFunc mocks the Create method.
|
// CreateFunc mocks the Create method.
|
||||||
@ -65,12 +65,12 @@ func (mock *PersonStoreMock) Create(ctx context.Context, person *Person, confirm
|
|||||||
panic("moq: PersonStoreMock.CreateFunc is nil but PersonStore.Create was just called")
|
panic("moq: PersonStoreMock.CreateFunc is nil but PersonStore.Create was just called")
|
||||||
}
|
}
|
||||||
callInfo := struct {
|
callInfo := struct {
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
Person *Person
|
Person *Person
|
||||||
Confirm bool
|
Confirm bool
|
||||||
}{
|
}{
|
||||||
Ctx: ctx,
|
Ctx: ctx,
|
||||||
Person: person,
|
Person: person,
|
||||||
Confirm: confirm,
|
Confirm: confirm,
|
||||||
}
|
}
|
||||||
lockPersonStoreMockCreate.Lock()
|
lockPersonStoreMockCreate.Lock()
|
||||||
@ -83,13 +83,13 @@ func (mock *PersonStoreMock) Create(ctx context.Context, person *Person, confirm
|
|||||||
// Check the length with:
|
// Check the length with:
|
||||||
// len(mockedPersonStore.CreateCalls())
|
// len(mockedPersonStore.CreateCalls())
|
||||||
func (mock *PersonStoreMock) CreateCalls() []struct {
|
func (mock *PersonStoreMock) CreateCalls() []struct {
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
Person *Person
|
Person *Person
|
||||||
Confirm bool
|
Confirm bool
|
||||||
} {
|
} {
|
||||||
var calls []struct {
|
var calls []struct {
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
Person *Person
|
Person *Person
|
||||||
Confirm bool
|
Confirm bool
|
||||||
}
|
}
|
||||||
lockPersonStoreMockCreate.RLock()
|
lockPersonStoreMockCreate.RLock()
|
||||||
@ -105,10 +105,10 @@ func (mock *PersonStoreMock) Get(ctx context.Context, id string) (*Person, error
|
|||||||
}
|
}
|
||||||
callInfo := struct {
|
callInfo := struct {
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
Id string
|
Id string
|
||||||
}{
|
}{
|
||||||
Ctx: ctx,
|
Ctx: ctx,
|
||||||
Id: id,
|
Id: id,
|
||||||
}
|
}
|
||||||
lockPersonStoreMockGet.Lock()
|
lockPersonStoreMockGet.Lock()
|
||||||
mock.calls.Get = append(mock.calls.Get, callInfo)
|
mock.calls.Get = append(mock.calls.Get, callInfo)
|
||||||
@ -120,12 +120,12 @@ func (mock *PersonStoreMock) Get(ctx context.Context, id string) (*Person, error
|
|||||||
// Check the length with:
|
// Check the length with:
|
||||||
// len(mockedPersonStore.GetCalls())
|
// len(mockedPersonStore.GetCalls())
|
||||||
func (mock *PersonStoreMock) GetCalls() []struct {
|
func (mock *PersonStoreMock) GetCalls() []struct {
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
Id string
|
Id string
|
||||||
} {
|
} {
|
||||||
var calls []struct {
|
var calls []struct {
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
Id string
|
Id string
|
||||||
}
|
}
|
||||||
lockPersonStoreMockGet.RLock()
|
lockPersonStoreMockGet.RLock()
|
||||||
calls = mock.calls.Get
|
calls = mock.calls.Get
|
||||||
|
Loading…
Reference in New Issue
Block a user