mirror of
https://github.com/containers/podman.git
synced 2025-12-03 11:49:18 +08:00
fix(deps): update module github.com/onsi/gomega to v1.36.3
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
126
vendor/github.com/onsi/gomega/gstruct/elements.go
generated
vendored
126
vendor/github.com/onsi/gomega/gstruct/elements.go
generated
vendored
@@ -14,16 +14,17 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
//MatchAllElements succeeds if every element of a slice matches the element matcher it maps to
|
||||
//through the id function, and every element matcher is matched.
|
||||
// idFn := func(element interface{}) string {
|
||||
// return fmt.Sprintf("%v", element)
|
||||
// }
|
||||
// MatchAllElements succeeds if every element of a slice matches the element matcher it maps to
|
||||
// through the id function, and every element matcher is matched.
|
||||
//
|
||||
// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{
|
||||
// "a": Equal("a"),
|
||||
// "b": Equal("b"),
|
||||
// }))
|
||||
// idFn := func(element any) string {
|
||||
// return fmt.Sprintf("%v", element)
|
||||
// }
|
||||
//
|
||||
// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{
|
||||
// "a": Equal("a"),
|
||||
// "b": Equal("b"),
|
||||
// }))
|
||||
func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatcher {
|
||||
return &ElementsMatcher{
|
||||
Identifier: identifier,
|
||||
@@ -31,16 +32,17 @@ func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatc
|
||||
}
|
||||
}
|
||||
|
||||
//MatchAllElementsWithIndex succeeds if every element of a slice matches the element matcher it maps to
|
||||
//through the id with index function, and every element matcher is matched.
|
||||
// idFn := func(index int, element interface{}) string {
|
||||
// return strconv.Itoa(index)
|
||||
// }
|
||||
// MatchAllElementsWithIndex succeeds if every element of a slice matches the element matcher it maps to
|
||||
// through the id with index function, and every element matcher is matched.
|
||||
//
|
||||
// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{
|
||||
// "0": Equal("a"),
|
||||
// "1": Equal("b"),
|
||||
// }))
|
||||
// idFn := func(index int, element any) string {
|
||||
// return strconv.Itoa(index)
|
||||
// }
|
||||
//
|
||||
// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{
|
||||
// "0": Equal("a"),
|
||||
// "1": Equal("b"),
|
||||
// }))
|
||||
func MatchAllElementsWithIndex(identifier IdentifierWithIndex, elements Elements) types.GomegaMatcher {
|
||||
return &ElementsMatcher{
|
||||
Identifier: identifier,
|
||||
@@ -48,22 +50,23 @@ func MatchAllElementsWithIndex(identifier IdentifierWithIndex, elements Elements
|
||||
}
|
||||
}
|
||||
|
||||
//MatchElements succeeds if each element of a slice matches the element matcher it maps to
|
||||
//through the id function. It can ignore extra elements and/or missing elements.
|
||||
// idFn := func(element interface{}) string {
|
||||
// return fmt.Sprintf("%v", element)
|
||||
// }
|
||||
// MatchElements succeeds if each element of a slice matches the element matcher it maps to
|
||||
// through the id function. It can ignore extra elements and/or missing elements.
|
||||
//
|
||||
// Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{
|
||||
// "a": Equal("a"),
|
||||
// "b": Equal("b"),
|
||||
// }))
|
||||
// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{
|
||||
// "a": Equal("a"),
|
||||
// "b": Equal("b"),
|
||||
// "c": Equal("c"),
|
||||
// "d": Equal("d"),
|
||||
// }))
|
||||
// idFn := func(element any) string {
|
||||
// return fmt.Sprintf("%v", element)
|
||||
// }
|
||||
//
|
||||
// Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{
|
||||
// "a": Equal("a"),
|
||||
// "b": Equal("b"),
|
||||
// }))
|
||||
// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{
|
||||
// "a": Equal("a"),
|
||||
// "b": Equal("b"),
|
||||
// "c": Equal("c"),
|
||||
// "d": Equal("d"),
|
||||
// }))
|
||||
func MatchElements(identifier Identifier, options Options, elements Elements) types.GomegaMatcher {
|
||||
return &ElementsMatcher{
|
||||
Identifier: identifier,
|
||||
@@ -74,22 +77,23 @@ func MatchElements(identifier Identifier, options Options, elements Elements) ty
|
||||
}
|
||||
}
|
||||
|
||||
//MatchElementsWithIndex succeeds if each element of a slice matches the element matcher it maps to
|
||||
//through the id with index function. It can ignore extra elements and/or missing elements.
|
||||
// idFn := func(index int, element interface{}) string {
|
||||
// return strconv.Itoa(index)
|
||||
// }
|
||||
// MatchElementsWithIndex succeeds if each element of a slice matches the element matcher it maps to
|
||||
// through the id with index function. It can ignore extra elements and/or missing elements.
|
||||
//
|
||||
// Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{
|
||||
// "0": Equal("a"),
|
||||
// "1": Equal("b"),
|
||||
// }))
|
||||
// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{
|
||||
// "0": Equal("a"),
|
||||
// "1": Equal("b"),
|
||||
// "2": Equal("c"),
|
||||
// "3": Equal("d"),
|
||||
// }))
|
||||
// idFn := func(index int, element any) string {
|
||||
// return strconv.Itoa(index)
|
||||
// }
|
||||
//
|
||||
// Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{
|
||||
// "0": Equal("a"),
|
||||
// "1": Equal("b"),
|
||||
// }))
|
||||
// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{
|
||||
// "0": Equal("a"),
|
||||
// "1": Equal("b"),
|
||||
// "2": Equal("c"),
|
||||
// "3": Equal("d"),
|
||||
// }))
|
||||
func MatchElementsWithIndex(identifier IdentifierWithIndex, options Options, elements Elements) types.GomegaMatcher {
|
||||
return &ElementsMatcher{
|
||||
Identifier: identifier,
|
||||
@@ -124,35 +128,35 @@ type ElementsMatcher struct {
|
||||
type Elements map[string]types.GomegaMatcher
|
||||
|
||||
// Function for identifying (mapping) elements.
|
||||
type Identifier func(element interface{}) string
|
||||
type Identifier func(element any) string
|
||||
|
||||
// Calls the underlying fucntion with the provided params.
|
||||
// Calls the underlying function with the provided params.
|
||||
// Identifier drops the index.
|
||||
func (i Identifier) WithIndexAndElement(index int, element interface{}) string {
|
||||
func (i Identifier) WithIndexAndElement(index int, element any) string {
|
||||
return i(element)
|
||||
}
|
||||
|
||||
// Uses the index and element to generate an element name
|
||||
type IdentifierWithIndex func(index int, element interface{}) string
|
||||
type IdentifierWithIndex func(index int, element any) string
|
||||
|
||||
// Calls the underlying fucntion with the provided params.
|
||||
// Calls the underlying function with the provided params.
|
||||
// IdentifierWithIndex uses the index.
|
||||
func (i IdentifierWithIndex) WithIndexAndElement(index int, element interface{}) string {
|
||||
func (i IdentifierWithIndex) WithIndexAndElement(index int, element any) string {
|
||||
return i(index, element)
|
||||
}
|
||||
|
||||
// Interface for identifing the element
|
||||
// Interface for identifying the element
|
||||
type Identify interface {
|
||||
WithIndexAndElement(i int, element interface{}) string
|
||||
WithIndexAndElement(i int, element any) string
|
||||
}
|
||||
|
||||
// IndexIdentity is a helper function for using an index as
|
||||
// the key in the element map
|
||||
func IndexIdentity(index int, _ interface{}) string {
|
||||
func IndexIdentity(index int, _ any) string {
|
||||
return strconv.Itoa(index)
|
||||
}
|
||||
|
||||
func (m *ElementsMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
func (m *ElementsMatcher) Match(actual any) (success bool, err error) {
|
||||
if reflect.TypeOf(actual).Kind() != reflect.Slice {
|
||||
return false, fmt.Errorf("%v is type %T, expected slice", actual, actual)
|
||||
}
|
||||
@@ -164,7 +168,7 @@ func (m *ElementsMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (m *ElementsMatcher) matchElements(actual interface{}) (errs []error) {
|
||||
func (m *ElementsMatcher) matchElements(actual any) (errs []error) {
|
||||
// Provide more useful error messages in the case of a panic.
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
@@ -217,12 +221,12 @@ func (m *ElementsMatcher) matchElements(actual interface{}) (errs []error) {
|
||||
return errs
|
||||
}
|
||||
|
||||
func (m *ElementsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
func (m *ElementsMatcher) FailureMessage(actual any) (message string) {
|
||||
failure := errorsutil.AggregateError(m.failures)
|
||||
return format.Message(actual, fmt.Sprintf("to match elements: %v", failure))
|
||||
}
|
||||
|
||||
func (m *ElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
func (m *ElementsMatcher) NegatedFailureMessage(actual any) (message string) {
|
||||
return format.Message(actual, "not to match elements")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user