mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-28 15:03:23 +00:00
2b5eeb8d24
Signed-off-by: Evan Lezar <elezar@nvidia.com>
111 lines
2.4 KiB
Go
111 lines
2.4 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package constraints
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that ConstraintMock does implement Constraint.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ Constraint = &ConstraintMock{}
|
|
|
|
// ConstraintMock is a mock implementation of Constraint.
|
|
//
|
|
// func TestSomethingThatUsesConstraint(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked Constraint
|
|
// mockedConstraint := &ConstraintMock{
|
|
// AssertFunc: func() error {
|
|
// panic("mock out the Assert method")
|
|
// },
|
|
// StringFunc: func() string {
|
|
// panic("mock out the String method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedConstraint in code that requires Constraint
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type ConstraintMock struct {
|
|
// AssertFunc mocks the Assert method.
|
|
AssertFunc func() error
|
|
|
|
// StringFunc mocks the String method.
|
|
StringFunc func() string
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// Assert holds details about calls to the Assert method.
|
|
Assert []struct {
|
|
}
|
|
// String holds details about calls to the String method.
|
|
String []struct {
|
|
}
|
|
}
|
|
lockAssert sync.RWMutex
|
|
lockString sync.RWMutex
|
|
}
|
|
|
|
// Assert calls AssertFunc.
|
|
func (mock *ConstraintMock) Assert() error {
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockAssert.Lock()
|
|
mock.calls.Assert = append(mock.calls.Assert, callInfo)
|
|
mock.lockAssert.Unlock()
|
|
if mock.AssertFunc == nil {
|
|
var (
|
|
errOut error
|
|
)
|
|
return errOut
|
|
}
|
|
return mock.AssertFunc()
|
|
}
|
|
|
|
// AssertCalls gets all the calls that were made to Assert.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedConstraint.AssertCalls())
|
|
func (mock *ConstraintMock) AssertCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockAssert.RLock()
|
|
calls = mock.calls.Assert
|
|
mock.lockAssert.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// String calls StringFunc.
|
|
func (mock *ConstraintMock) 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(mockedConstraint.StringCalls())
|
|
func (mock *ConstraintMock) StringCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockString.RLock()
|
|
calls = mock.calls.String
|
|
mock.lockString.RUnlock()
|
|
return calls
|
|
}
|