mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-27 06:19:34 +00:00
2b5eeb8d24
Signed-off-by: Evan Lezar <elezar@nvidia.com>
79 lines
1.6 KiB
Go
79 lines
1.6 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package lookup
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that LocatorMock does implement Locator.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ Locator = &LocatorMock{}
|
|
|
|
// LocatorMock is a mock implementation of Locator.
|
|
//
|
|
// func TestSomethingThatUsesLocator(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked Locator
|
|
// mockedLocator := &LocatorMock{
|
|
// LocateFunc: func(s string) ([]string, error) {
|
|
// panic("mock out the Locate method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedLocator in code that requires Locator
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type LocatorMock struct {
|
|
// LocateFunc mocks the Locate method.
|
|
LocateFunc func(s string) ([]string, error)
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// Locate holds details about calls to the Locate method.
|
|
Locate []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
}
|
|
}
|
|
lockLocate sync.RWMutex
|
|
}
|
|
|
|
// Locate calls LocateFunc.
|
|
func (mock *LocatorMock) Locate(s string) ([]string, error) {
|
|
callInfo := struct {
|
|
S string
|
|
}{
|
|
S: s,
|
|
}
|
|
mock.lockLocate.Lock()
|
|
mock.calls.Locate = append(mock.calls.Locate, callInfo)
|
|
mock.lockLocate.Unlock()
|
|
if mock.LocateFunc == nil {
|
|
var (
|
|
stringsOut []string
|
|
errOut error
|
|
)
|
|
return stringsOut, errOut
|
|
}
|
|
return mock.LocateFunc(s)
|
|
}
|
|
|
|
// LocateCalls gets all the calls that were made to Locate.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedLocator.LocateCalls())
|
|
func (mock *LocatorMock) LocateCalls() []struct {
|
|
S string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
}
|
|
mock.lockLocate.RLock()
|
|
calls = mock.calls.Locate
|
|
mock.lockLocate.RUnlock()
|
|
return calls
|
|
}
|