vendor: bump all direct dependencies
Just good hygiene. Signed-off-by: Casey Callendrello <cdc@redhat.com>
This commit is contained in:
5
vendor/github.com/onsi/gomega/matchers/and.go
generated
vendored
5
vendor/github.com/onsi/gomega/matchers/and.go
generated
vendored
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
"github.com/onsi/gomega/internal/oraclematcher"
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
@@ -52,12 +51,12 @@ func (m *AndMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
|
||||
if m.firstFailedMatcher == nil {
|
||||
// so all matchers succeeded.. Any one of them changing would change the result.
|
||||
for _, matcher := range m.Matchers {
|
||||
if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) {
|
||||
if types.MatchMayChangeInTheFuture(matcher, actual) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false // none of were going to change
|
||||
}
|
||||
// one of the matchers failed.. it must be able to change in order to affect the result
|
||||
return oraclematcher.MatchMayChangeInTheFuture(m.firstFailedMatcher, actual)
|
||||
return types.MatchMayChangeInTheFuture(m.firstFailedMatcher, actual)
|
||||
}
|
||||
|
||||
22
vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go
generated
vendored
22
vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go
generated
vendored
@@ -18,23 +18,9 @@ func (matcher *BeElementOfMatcher) Match(actual interface{}) (success bool, err
|
||||
return false, fmt.Errorf("BeElement matcher expects actual to be typed")
|
||||
}
|
||||
|
||||
length := len(matcher.Elements)
|
||||
valueAt := func(i int) interface{} {
|
||||
return matcher.Elements[i]
|
||||
}
|
||||
// Special handling of a single element of type Array or Slice
|
||||
if length == 1 && isArrayOrSlice(valueAt(0)) {
|
||||
element := valueAt(0)
|
||||
value := reflect.ValueOf(element)
|
||||
length = value.Len()
|
||||
valueAt = func(i int) interface{} {
|
||||
return value.Index(i).Interface()
|
||||
}
|
||||
}
|
||||
|
||||
var lastError error
|
||||
for i := 0; i < length; i++ {
|
||||
matcher := &EqualMatcher{Expected: valueAt(i)}
|
||||
for _, m := range flatten(matcher.Elements) {
|
||||
matcher := &EqualMatcher{Expected: m}
|
||||
success, err := matcher.Match(actual)
|
||||
if err != nil {
|
||||
lastError = err
|
||||
@@ -49,9 +35,9 @@ func (matcher *BeElementOfMatcher) Match(actual interface{}) (success bool, err
|
||||
}
|
||||
|
||||
func (matcher *BeElementOfMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to be an element of", matcher.Elements)
|
||||
return format.Message(actual, "to be an element of", presentable(matcher.Elements))
|
||||
}
|
||||
|
||||
func (matcher *BeElementOfMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to be an element of", matcher.Elements)
|
||||
return format.Message(actual, "not to be an element of", presentable(matcher.Elements))
|
||||
}
|
||||
|
||||
2
vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go
generated
vendored
@@ -45,7 +45,7 @@ func (matcher *BeNumericallyMatcher) Match(actual interface{}) (success bool, er
|
||||
return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1))
|
||||
}
|
||||
if len(matcher.CompareTo) == 2 && !isNumber(matcher.CompareTo[1]) {
|
||||
return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1))
|
||||
return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[1], 1))
|
||||
}
|
||||
|
||||
switch matcher.Comparator {
|
||||
|
||||
53
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
53
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
@@ -57,17 +57,21 @@ func equalMatchersToElements(matchers []interface{}) (elements []interface{}) {
|
||||
return
|
||||
}
|
||||
|
||||
func matchers(expectedElems []interface{}) (matchers []interface{}) {
|
||||
elems := expectedElems
|
||||
if len(expectedElems) == 1 && isArrayOrSlice(expectedElems[0]) {
|
||||
elems = []interface{}{}
|
||||
value := reflect.ValueOf(expectedElems[0])
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
elems = append(elems, value.Index(i).Interface())
|
||||
}
|
||||
func flatten(elems []interface{}) []interface{} {
|
||||
if len(elems) != 1 || !isArrayOrSlice(elems[0]) {
|
||||
return elems
|
||||
}
|
||||
|
||||
for _, e := range elems {
|
||||
value := reflect.ValueOf(elems[0])
|
||||
flattened := make([]interface{}, value.Len())
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
flattened[i] = value.Index(i).Interface()
|
||||
}
|
||||
return flattened
|
||||
}
|
||||
|
||||
func matchers(expectedElems []interface{}) (matchers []interface{}) {
|
||||
for _, e := range flatten(expectedElems) {
|
||||
matcher, isMatcher := e.(omegaMatcher)
|
||||
if !isMatcher {
|
||||
matcher = &EqualMatcher{Expected: e}
|
||||
@@ -77,6 +81,29 @@ func matchers(expectedElems []interface{}) (matchers []interface{}) {
|
||||
return
|
||||
}
|
||||
|
||||
func presentable(elems []interface{}) interface{} {
|
||||
elems = flatten(elems)
|
||||
|
||||
if len(elems) == 0 {
|
||||
return []interface{}{}
|
||||
}
|
||||
|
||||
sv := reflect.ValueOf(elems)
|
||||
tt := sv.Index(0).Elem().Type()
|
||||
for i := 1; i < sv.Len(); i++ {
|
||||
if sv.Index(i).Elem().Type() != tt {
|
||||
return elems
|
||||
}
|
||||
}
|
||||
|
||||
ss := reflect.MakeSlice(reflect.SliceOf(tt), sv.Len(), sv.Len())
|
||||
for i := 0; i < sv.Len(); i++ {
|
||||
ss.Index(i).Set(sv.Index(i).Elem())
|
||||
}
|
||||
|
||||
return ss.Interface()
|
||||
}
|
||||
|
||||
func valuesOf(actual interface{}) []interface{} {
|
||||
value := reflect.ValueOf(actual)
|
||||
values := []interface{}{}
|
||||
@@ -95,11 +122,11 @@ func valuesOf(actual interface{}) []interface{} {
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
message = format.Message(actual, "to consist of", matcher.Elements)
|
||||
message = format.Message(actual, "to consist of", presentable(matcher.Elements))
|
||||
message = appendMissingElements(message, matcher.missingElements)
|
||||
if len(matcher.extraElements) > 0 {
|
||||
message = fmt.Sprintf("%s\nthe extra elements were\n%s", message,
|
||||
format.Object(matcher.extraElements, 1))
|
||||
format.Object(presentable(matcher.extraElements), 1))
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -109,9 +136,9 @@ func appendMissingElements(message string, missingElements []interface{}) string
|
||||
return message
|
||||
}
|
||||
return fmt.Sprintf("%s\nthe missing elements were\n%s", message,
|
||||
format.Object(missingElements, 1))
|
||||
format.Object(presentable(missingElements), 1))
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to consist of", matcher.Elements)
|
||||
return format.Message(actual, "not to consist of", presentable(matcher.Elements))
|
||||
}
|
||||
|
||||
4
vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go
generated
vendored
4
vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go
generated
vendored
@@ -35,10 +35,10 @@ func (matcher *ContainElementsMatcher) Match(actual interface{}) (success bool,
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
message = format.Message(actual, "to contain elements", matcher.Elements)
|
||||
message = format.Message(actual, "to contain elements", presentable(matcher.Elements))
|
||||
return appendMissingElements(message, matcher.missingElements)
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to contain elements", matcher.Elements)
|
||||
return format.Message(actual, "not to contain elements", presentable(matcher.Elements))
|
||||
}
|
||||
|
||||
4
vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
generated
vendored
4
vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
generated
vendored
@@ -1,11 +1,11 @@
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
type MatchErrorMatcher struct {
|
||||
@@ -25,7 +25,7 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e
|
||||
expected := matcher.Expected
|
||||
|
||||
if isError(expected) {
|
||||
return reflect.DeepEqual(actualErr, expected) || xerrors.Is(actualErr, expected.(error)), nil
|
||||
return reflect.DeepEqual(actualErr, expected) || errors.Is(actualErr, expected.(error)), nil
|
||||
}
|
||||
|
||||
if isString(expected) {
|
||||
|
||||
3
vendor/github.com/onsi/gomega/matchers/not.go
generated
vendored
3
vendor/github.com/onsi/gomega/matchers/not.go
generated
vendored
@@ -1,7 +1,6 @@
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"github.com/onsi/gomega/internal/oraclematcher"
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
@@ -26,5 +25,5 @@ func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string)
|
||||
}
|
||||
|
||||
func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
|
||||
return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value
|
||||
return types.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value
|
||||
}
|
||||
|
||||
5
vendor/github.com/onsi/gomega/matchers/or.go
generated
vendored
5
vendor/github.com/onsi/gomega/matchers/or.go
generated
vendored
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
"github.com/onsi/gomega/internal/oraclematcher"
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
@@ -54,11 +53,11 @@ func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
|
||||
|
||||
if m.firstSuccessfulMatcher != nil {
|
||||
// one of the matchers succeeded.. it must be able to change in order to affect the result
|
||||
return oraclematcher.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual)
|
||||
return types.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual)
|
||||
} else {
|
||||
// so all matchers failed.. Any one of them changing would change the result.
|
||||
for _, matcher := range m.Matchers {
|
||||
if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) {
|
||||
if types.MatchMayChangeInTheFuture(matcher, actual) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
66
vendor/github.com/onsi/gomega/matchers/satisfy_matcher.go
generated
vendored
Normal file
66
vendor/github.com/onsi/gomega/matchers/satisfy_matcher.go
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
)
|
||||
|
||||
type SatisfyMatcher struct {
|
||||
Predicate interface{}
|
||||
|
||||
// cached type
|
||||
predicateArgType reflect.Type
|
||||
}
|
||||
|
||||
func NewSatisfyMatcher(predicate interface{}) *SatisfyMatcher {
|
||||
if predicate == nil {
|
||||
panic("predicate cannot be nil")
|
||||
}
|
||||
predicateType := reflect.TypeOf(predicate)
|
||||
if predicateType.Kind() != reflect.Func {
|
||||
panic("predicate must be a function")
|
||||
}
|
||||
if predicateType.NumIn() != 1 {
|
||||
panic("predicate must have 1 argument")
|
||||
}
|
||||
if predicateType.NumOut() != 1 || predicateType.Out(0).Kind() != reflect.Bool {
|
||||
panic("predicate must return bool")
|
||||
}
|
||||
|
||||
return &SatisfyMatcher{
|
||||
Predicate: predicate,
|
||||
predicateArgType: predicateType.In(0),
|
||||
}
|
||||
}
|
||||
|
||||
func (m *SatisfyMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
// prepare a parameter to pass to the predicate
|
||||
var param reflect.Value
|
||||
if actual != nil && reflect.TypeOf(actual).AssignableTo(m.predicateArgType) {
|
||||
// The dynamic type of actual is compatible with the predicate argument.
|
||||
param = reflect.ValueOf(actual)
|
||||
|
||||
} else if actual == nil && m.predicateArgType.Kind() == reflect.Interface {
|
||||
// The dynamic type of actual is unknown, so there's no way to make its
|
||||
// reflect.Value. Create a nil of the predicate argument, which is known.
|
||||
param = reflect.Zero(m.predicateArgType)
|
||||
|
||||
} else {
|
||||
return false, fmt.Errorf("predicate expects '%s' but we have '%T'", m.predicateArgType, actual)
|
||||
}
|
||||
|
||||
// call the predicate with `actual`
|
||||
fn := reflect.ValueOf(m.Predicate)
|
||||
result := fn.Call([]reflect.Value{param})
|
||||
return result[0].Bool(), nil
|
||||
}
|
||||
|
||||
func (m *SatisfyMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to satisfy predicate", m.Predicate)
|
||||
}
|
||||
|
||||
func (m *SatisfyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to not satisfy predicate", m.Predicate)
|
||||
}
|
||||
22
vendor/github.com/onsi/gomega/matchers/with_transform.go
generated
vendored
22
vendor/github.com/onsi/gomega/matchers/with_transform.go
generated
vendored
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/onsi/gomega/internal/oraclematcher"
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
@@ -40,15 +39,24 @@ func NewWithTransformMatcher(transform interface{}, matcher types.GomegaMatcher)
|
||||
}
|
||||
|
||||
func (m *WithTransformMatcher) Match(actual interface{}) (bool, error) {
|
||||
// return error if actual's type is incompatible with Transform function's argument type
|
||||
actualType := reflect.TypeOf(actual)
|
||||
if !actualType.AssignableTo(m.transformArgType) {
|
||||
return false, fmt.Errorf("Transform function expects '%s' but we have '%s'", m.transformArgType, actualType)
|
||||
// prepare a parameter to pass to the Transform function
|
||||
var param reflect.Value
|
||||
if actual != nil && reflect.TypeOf(actual).AssignableTo(m.transformArgType) {
|
||||
// The dynamic type of actual is compatible with the transform argument.
|
||||
param = reflect.ValueOf(actual)
|
||||
|
||||
} else if actual == nil && m.transformArgType.Kind() == reflect.Interface {
|
||||
// The dynamic type of actual is unknown, so there's no way to make its
|
||||
// reflect.Value. Create a nil of the transform argument, which is known.
|
||||
param = reflect.Zero(m.transformArgType)
|
||||
|
||||
} else {
|
||||
return false, fmt.Errorf("Transform function expects '%s' but we have '%T'", m.transformArgType, actual)
|
||||
}
|
||||
|
||||
// call the Transform function with `actual`
|
||||
fn := reflect.ValueOf(m.Transform)
|
||||
result := fn.Call([]reflect.Value{reflect.ValueOf(actual)})
|
||||
result := fn.Call([]reflect.Value{param})
|
||||
m.transformedValue = result[0].Interface() // expect exactly one value
|
||||
|
||||
return m.Matcher.Match(m.transformedValue)
|
||||
@@ -68,5 +76,5 @@ func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ interface{}) bool {
|
||||
// Querying the next matcher is fine if the transformer always will return the same value.
|
||||
// But if the transformer is non-deterministic and returns a different value each time, then there
|
||||
// is no point in querying the next matcher, since it can only comment on the last transformed value.
|
||||
return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, m.transformedValue)
|
||||
return types.MatchMayChangeInTheFuture(m.Matcher, m.transformedValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user