Documentation ¶
Index ¶
- type Constraint
- type ConstraintMock
- type Property
- type PropertyMock
- func (mock *PropertyMock) CompareTo(s string) (int, error)
- func (mock *PropertyMock) CompareToCalls() []struct{ ... }
- func (mock *PropertyMock) Name() string
- func (mock *PropertyMock) NameCalls() []struct{}
- func (mock *PropertyMock) String() string
- func (mock *PropertyMock) StringCalls() []struct{}
- func (mock *PropertyMock) Validate(s string) error
- func (mock *PropertyMock) ValidateCalls() []struct{ ... }
- func (mock *PropertyMock) Value() (string, error)
- func (mock *PropertyMock) ValueCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
Constraint represents a constraint that is to be evaluated
func AND ¶
func AND(constraints []Constraint) Constraint
AND constructs a new constraint that is the logical AND of the supplied constraints
func New ¶
func New(logger logger.Interface, requirements []string, properties map[string]Property) (Constraint, error)
New creates a new constraint for the supplied requirements and properties
func OR ¶
func OR(constraints []Constraint) Constraint
OR constructs a new constrant that is the logical OR of the supplied constraints
type ConstraintMock ¶
type ConstraintMock struct { // AssertFunc mocks the Assert method. AssertFunc func() error // StringFunc mocks the String method. StringFunc func() string // contains filtered or unexported fields }
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. }
func (*ConstraintMock) AssertCalls ¶
func (mock *ConstraintMock) AssertCalls() []struct { }
AssertCalls gets all the calls that were made to Assert. Check the length with:
len(mockedConstraint.AssertCalls())
func (*ConstraintMock) String ¶
func (mock *ConstraintMock) String() string
String calls StringFunc.
func (*ConstraintMock) StringCalls ¶
func (mock *ConstraintMock) StringCalls() []struct { }
StringCalls gets all the calls that were made to String. Check the length with:
len(mockedConstraint.StringCalls())
type Property ¶
type Property interface { Name() string Value() (string, error) String() string CompareTo(string) (int, error) Validate(string) error }
Property represents a property that is used to check requirements
func NewStringProperty ¶
NewStringProperty creates a string property based on the name-value pair
func NewVersionProperty ¶
NewVersionProperty creates a property representing a semantic version based on the name-value pair
type PropertyMock ¶
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) // contains filtered or unexported fields }
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. }
func (*PropertyMock) CompareTo ¶
func (mock *PropertyMock) CompareTo(s string) (int, error)
CompareTo calls CompareToFunc.
func (*PropertyMock) CompareToCalls ¶
func (mock *PropertyMock) CompareToCalls() []struct { S string }
CompareToCalls gets all the calls that were made to CompareTo. Check the length with:
len(mockedProperty.CompareToCalls())
func (*PropertyMock) NameCalls ¶
func (mock *PropertyMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedProperty.NameCalls())
func (*PropertyMock) StringCalls ¶
func (mock *PropertyMock) StringCalls() []struct { }
StringCalls gets all the calls that were made to String. Check the length with:
len(mockedProperty.StringCalls())
func (*PropertyMock) Validate ¶
func (mock *PropertyMock) Validate(s string) error
Validate calls ValidateFunc.
func (*PropertyMock) ValidateCalls ¶
func (mock *PropertyMock) ValidateCalls() []struct { S string }
ValidateCalls gets all the calls that were made to Validate. Check the length with:
len(mockedProperty.ValidateCalls())
func (*PropertyMock) Value ¶
func (mock *PropertyMock) Value() (string, error)
Value calls ValueFunc.
func (*PropertyMock) ValueCalls ¶
func (mock *PropertyMock) ValueCalls() []struct { }
ValueCalls gets all the calls that were made to Value. Check the length with:
len(mockedProperty.ValueCalls())