go.mod: bump all deps
Bump all transitive and direct dependencies. Signed-off-by: Casey Callendrello <c1@caseyc.net>
This commit is contained in:
29
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
29
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
@@ -48,11 +48,13 @@ func neighbours(value, matcher interface{}) (bool, error) {
|
||||
|
||||
func equalMatchersToElements(matchers []interface{}) (elements []interface{}) {
|
||||
for _, matcher := range matchers {
|
||||
equalMatcher, ok := matcher.(*EqualMatcher)
|
||||
if ok {
|
||||
matcher = equalMatcher.Expected
|
||||
if equalMatcher, ok := matcher.(*EqualMatcher); ok {
|
||||
elements = append(elements, equalMatcher.Expected)
|
||||
} else if _, ok := matcher.(*BeNilMatcher); ok {
|
||||
elements = append(elements, nil)
|
||||
} else {
|
||||
elements = append(elements, matcher)
|
||||
}
|
||||
elements = append(elements, matcher)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -72,11 +74,13 @@ func flatten(elems []interface{}) []interface{} {
|
||||
|
||||
func matchers(expectedElems []interface{}) (matchers []interface{}) {
|
||||
for _, e := range flatten(expectedElems) {
|
||||
matcher, isMatcher := e.(omegaMatcher)
|
||||
if !isMatcher {
|
||||
matcher = &EqualMatcher{Expected: e}
|
||||
if e == nil {
|
||||
matchers = append(matchers, &BeNilMatcher{})
|
||||
} else if matcher, isMatcher := e.(omegaMatcher); isMatcher {
|
||||
matchers = append(matchers, matcher)
|
||||
} else {
|
||||
matchers = append(matchers, &EqualMatcher{Expected: e})
|
||||
}
|
||||
matchers = append(matchers, matcher)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -89,9 +93,14 @@ func presentable(elems []interface{}) interface{} {
|
||||
}
|
||||
|
||||
sv := reflect.ValueOf(elems)
|
||||
tt := sv.Index(0).Elem().Type()
|
||||
firstEl := sv.Index(0)
|
||||
if firstEl.IsNil() {
|
||||
return elems
|
||||
}
|
||||
tt := firstEl.Elem().Type()
|
||||
for i := 1; i < sv.Len(); i++ {
|
||||
if sv.Index(i).Elem().Type() != tt {
|
||||
el := sv.Index(i)
|
||||
if el.IsNil() || (sv.Index(i).Elem().Type() != tt) {
|
||||
return elems
|
||||
}
|
||||
}
|
||||
|
||||
83
vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
generated
vendored
Normal file
83
vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
)
|
||||
|
||||
type mismatchFailure struct {
|
||||
failure string
|
||||
index int
|
||||
}
|
||||
|
||||
type HaveExactElementsMatcher struct {
|
||||
Elements []interface{}
|
||||
mismatchFailures []mismatchFailure
|
||||
missingIndex int
|
||||
extraIndex int
|
||||
}
|
||||
|
||||
func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
matcher.resetState()
|
||||
|
||||
if isMap(actual) {
|
||||
return false, fmt.Errorf("error")
|
||||
}
|
||||
|
||||
matchers := matchers(matcher.Elements)
|
||||
values := valuesOf(actual)
|
||||
|
||||
lenMatchers := len(matchers)
|
||||
lenValues := len(values)
|
||||
|
||||
for i := 0; i < lenMatchers || i < lenValues; i++ {
|
||||
if i >= lenMatchers {
|
||||
matcher.extraIndex = i
|
||||
continue
|
||||
}
|
||||
|
||||
if i >= lenValues {
|
||||
matcher.missingIndex = i
|
||||
return
|
||||
}
|
||||
|
||||
elemMatcher := matchers[i].(omegaMatcher)
|
||||
match, err := elemMatcher.Match(values[i])
|
||||
if err != nil || !match {
|
||||
matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{
|
||||
index: i,
|
||||
failure: elemMatcher.FailureMessage(values[i]),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return matcher.missingIndex+matcher.extraIndex+len(matcher.mismatchFailures) == 0, nil
|
||||
}
|
||||
|
||||
func (matcher *HaveExactElementsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
message = format.Message(actual, "to have exact elements with", presentable(matcher.Elements))
|
||||
if matcher.missingIndex > 0 {
|
||||
message = fmt.Sprintf("%s\nthe missing elements start from index %d", message, matcher.missingIndex)
|
||||
}
|
||||
if matcher.extraIndex > 0 {
|
||||
message = fmt.Sprintf("%s\nthe extra elements start from index %d", message, matcher.extraIndex)
|
||||
}
|
||||
if len(matcher.mismatchFailures) != 0 {
|
||||
message = fmt.Sprintf("%s\nthe mismatch indexes were:", message)
|
||||
}
|
||||
for _, mismatch := range matcher.mismatchFailures {
|
||||
message = fmt.Sprintf("%s\n%d: %s", message, mismatch.index, mismatch.failure)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (matcher *HaveExactElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to contain elements", presentable(matcher.Elements))
|
||||
}
|
||||
|
||||
func (matcher *HaveExactElementsMatcher) resetState() {
|
||||
matcher.mismatchFailures = nil
|
||||
matcher.missingIndex = 0
|
||||
matcher.extraIndex = 0
|
||||
}
|
||||
2
vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go
generated
vendored
@@ -31,5 +31,5 @@ func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message
|
||||
}
|
||||
|
||||
func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return fmt.Sprintf("Unexpected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "occurred")
|
||||
return fmt.Sprintf("Unexpected error:\n%s\n%s", format.Object(actual, 1), "occurred")
|
||||
}
|
||||
|
||||
2
vendor/github.com/onsi/gomega/matchers/succeed_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/succeed_matcher.go
generated
vendored
@@ -34,7 +34,7 @@ func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message strin
|
||||
if errors.As(actual.(error), &fgErr) {
|
||||
return fgErr.FormattedGomegaError()
|
||||
}
|
||||
return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1))
|
||||
return fmt.Sprintf("Expected success, but got an error:\n%s", format.Object(actual, 1))
|
||||
}
|
||||
|
||||
func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
|
||||
Reference in New Issue
Block a user