Documentation
¶
Index ¶
- func AssertCharDevice(path string) error
- func IsOverrideApplied() bool
- func SetAllForTest() func()
- func SetAssertCharDeviceForTest(testFunc func(string) error) func()
- func SetDeviceFromPathForTest(testFunc func(string, string) (*Device, error)) func()
- func SetInterfaceForTests(m Interface) func()
- func SetIsOverrideAppliedForTest(testFunc func() bool) func()
- type Device
- type Interface
- type InterfaceMock
- func (mock *InterfaceMock) AssertCharDevice(s string) error
- func (mock *InterfaceMock) AssertCharDeviceCalls() []struct{ ... }
- func (mock *InterfaceMock) DeviceFromPath(s1 string, s2 string) (*Device, error)
- func (mock *InterfaceMock) DeviceFromPathCalls() []struct{ ... }
- func (mock *InterfaceMock) IsOverrideApplied() bool
- func (mock *InterfaceMock) IsOverrideAppliedCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCharDevice ¶
AssertCharDevice checks whether the specified path is a char device and returns an error if this is not the case.
func IsOverrideApplied ¶
func IsOverrideApplied() bool
func SetAllForTest ¶
func SetAllForTest() func()
func SetInterfaceForTests ¶
func SetInterfaceForTests(m Interface) func()
func SetIsOverrideAppliedForTest ¶
func SetIsOverrideAppliedForTest(testFunc func() bool) func()
Types ¶
type InterfaceMock ¶
type InterfaceMock struct {
// AssertCharDeviceFunc mocks the AssertCharDevice method.
AssertCharDeviceFunc func(s string) error
// DeviceFromPathFunc mocks the DeviceFromPath method.
DeviceFromPathFunc func(s1 string, s2 string) (*Device, error)
// IsOverrideAppliedFunc mocks the IsOverrideApplied method.
IsOverrideAppliedFunc func() bool
// contains filtered or unexported fields
}
InterfaceMock is a mock implementation of Interface.
func TestSomethingThatUsesInterface(t *testing.T) {
// make and configure a mocked Interface
mockedInterface := &InterfaceMock{
AssertCharDeviceFunc: func(s string) error {
panic("mock out the AssertCharDevice method")
},
DeviceFromPathFunc: func(s1 string, s2 string) (*Device, error) {
panic("mock out the DeviceFromPath method")
},
IsOverrideAppliedFunc: func() bool {
panic("mock out the IsOverrideApplied method")
},
}
// use mockedInterface in code that requires Interface
// and then make assertions.
}
func (*InterfaceMock) AssertCharDevice ¶
func (mock *InterfaceMock) AssertCharDevice(s string) error
AssertCharDevice calls AssertCharDeviceFunc.
func (*InterfaceMock) AssertCharDeviceCalls ¶
func (mock *InterfaceMock) AssertCharDeviceCalls() []struct { S string }
AssertCharDeviceCalls gets all the calls that were made to AssertCharDevice. Check the length with:
len(mockedInterface.AssertCharDeviceCalls())
func (*InterfaceMock) DeviceFromPath ¶
func (mock *InterfaceMock) DeviceFromPath(s1 string, s2 string) (*Device, error)
DeviceFromPath calls DeviceFromPathFunc.
func (*InterfaceMock) DeviceFromPathCalls ¶
func (mock *InterfaceMock) DeviceFromPathCalls() []struct { S1 string S2 string }
DeviceFromPathCalls gets all the calls that were made to DeviceFromPath. Check the length with:
len(mockedInterface.DeviceFromPathCalls())
func (*InterfaceMock) IsOverrideApplied ¶
func (mock *InterfaceMock) IsOverrideApplied() bool
IsOverrideApplied calls IsOverrideAppliedFunc.
func (*InterfaceMock) IsOverrideAppliedCalls ¶
func (mock *InterfaceMock) IsOverrideAppliedCalls() []struct { }
IsOverrideAppliedCalls gets all the calls that were made to IsOverrideApplied. Check the length with:
len(mockedInterface.IsOverrideAppliedCalls())
Click to show internal directories.
Click to hide internal directories.