mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-28 23:17:24 +00:00
2b5eeb8d24
Signed-off-by: Evan Lezar <elezar@nvidia.com>
247 lines
5.2 KiB
Go
247 lines
5.2 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package constraints
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that PropertyMock does implement Property.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ Property = &PropertyMock{}
|
|
|
|
// PropertyMock is a mock implementation of Property.
|
|
//
|
|
// func TestSomethingThatUsesProperty(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked Property
|
|
// mockedProperty := &PropertyMock{
|
|
// CompareToFunc: func(s string) (int, error) {
|
|
// panic("mock out the CompareTo method")
|
|
// },
|
|
// NameFunc: func() string {
|
|
// panic("mock out the Name method")
|
|
// },
|
|
// StringFunc: func() string {
|
|
// panic("mock out the String method")
|
|
// },
|
|
// ValidateFunc: func(s string) error {
|
|
// panic("mock out the Validate method")
|
|
// },
|
|
// ValueFunc: func() (string, error) {
|
|
// panic("mock out the Value method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedProperty in code that requires Property
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type PropertyMock struct {
|
|
// CompareToFunc mocks the CompareTo method.
|
|
CompareToFunc func(s string) (int, error)
|
|
|
|
// NameFunc mocks the Name method.
|
|
NameFunc func() string
|
|
|
|
// StringFunc mocks the String method.
|
|
StringFunc func() string
|
|
|
|
// ValidateFunc mocks the Validate method.
|
|
ValidateFunc func(s string) error
|
|
|
|
// ValueFunc mocks the Value method.
|
|
ValueFunc func() (string, error)
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// CompareTo holds details about calls to the CompareTo method.
|
|
CompareTo []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
}
|
|
// Name holds details about calls to the Name method.
|
|
Name []struct {
|
|
}
|
|
// String holds details about calls to the String method.
|
|
String []struct {
|
|
}
|
|
// Validate holds details about calls to the Validate method.
|
|
Validate []struct {
|
|
// S is the s argument value.
|
|
S string
|
|
}
|
|
// Value holds details about calls to the Value method.
|
|
Value []struct {
|
|
}
|
|
}
|
|
lockCompareTo sync.RWMutex
|
|
lockName sync.RWMutex
|
|
lockString sync.RWMutex
|
|
lockValidate sync.RWMutex
|
|
lockValue sync.RWMutex
|
|
}
|
|
|
|
// CompareTo calls CompareToFunc.
|
|
func (mock *PropertyMock) CompareTo(s string) (int, error) {
|
|
callInfo := struct {
|
|
S string
|
|
}{
|
|
S: s,
|
|
}
|
|
mock.lockCompareTo.Lock()
|
|
mock.calls.CompareTo = append(mock.calls.CompareTo, callInfo)
|
|
mock.lockCompareTo.Unlock()
|
|
if mock.CompareToFunc == nil {
|
|
var (
|
|
nOut int
|
|
errOut error
|
|
)
|
|
return nOut, errOut
|
|
}
|
|
return mock.CompareToFunc(s)
|
|
}
|
|
|
|
// CompareToCalls gets all the calls that were made to CompareTo.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedProperty.CompareToCalls())
|
|
func (mock *PropertyMock) CompareToCalls() []struct {
|
|
S string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
}
|
|
mock.lockCompareTo.RLock()
|
|
calls = mock.calls.CompareTo
|
|
mock.lockCompareTo.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Name calls NameFunc.
|
|
func (mock *PropertyMock) Name() string {
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockName.Lock()
|
|
mock.calls.Name = append(mock.calls.Name, callInfo)
|
|
mock.lockName.Unlock()
|
|
if mock.NameFunc == nil {
|
|
var (
|
|
sOut string
|
|
)
|
|
return sOut
|
|
}
|
|
return mock.NameFunc()
|
|
}
|
|
|
|
// NameCalls gets all the calls that were made to Name.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedProperty.NameCalls())
|
|
func (mock *PropertyMock) NameCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockName.RLock()
|
|
calls = mock.calls.Name
|
|
mock.lockName.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// String calls StringFunc.
|
|
func (mock *PropertyMock) String() string {
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockString.Lock()
|
|
mock.calls.String = append(mock.calls.String, callInfo)
|
|
mock.lockString.Unlock()
|
|
if mock.StringFunc == nil {
|
|
var (
|
|
sOut string
|
|
)
|
|
return sOut
|
|
}
|
|
return mock.StringFunc()
|
|
}
|
|
|
|
// StringCalls gets all the calls that were made to String.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedProperty.StringCalls())
|
|
func (mock *PropertyMock) StringCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockString.RLock()
|
|
calls = mock.calls.String
|
|
mock.lockString.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Validate calls ValidateFunc.
|
|
func (mock *PropertyMock) Validate(s string) error {
|
|
callInfo := struct {
|
|
S string
|
|
}{
|
|
S: s,
|
|
}
|
|
mock.lockValidate.Lock()
|
|
mock.calls.Validate = append(mock.calls.Validate, callInfo)
|
|
mock.lockValidate.Unlock()
|
|
if mock.ValidateFunc == nil {
|
|
var (
|
|
errOut error
|
|
)
|
|
return errOut
|
|
}
|
|
return mock.ValidateFunc(s)
|
|
}
|
|
|
|
// ValidateCalls gets all the calls that were made to Validate.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedProperty.ValidateCalls())
|
|
func (mock *PropertyMock) ValidateCalls() []struct {
|
|
S string
|
|
} {
|
|
var calls []struct {
|
|
S string
|
|
}
|
|
mock.lockValidate.RLock()
|
|
calls = mock.calls.Validate
|
|
mock.lockValidate.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Value calls ValueFunc.
|
|
func (mock *PropertyMock) Value() (string, error) {
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockValue.Lock()
|
|
mock.calls.Value = append(mock.calls.Value, callInfo)
|
|
mock.lockValue.Unlock()
|
|
if mock.ValueFunc == nil {
|
|
var (
|
|
sOut string
|
|
errOut error
|
|
)
|
|
return sOut, errOut
|
|
}
|
|
return mock.ValueFunc()
|
|
}
|
|
|
|
// ValueCalls gets all the calls that were made to Value.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedProperty.ValueCalls())
|
|
func (mock *PropertyMock) ValueCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockValue.RLock()
|
|
calls = mock.calls.Value
|
|
mock.lockValue.RUnlock()
|
|
return calls
|
|
}
|