mirror of
https://github.com/containers/podman.git
synced 2025-12-01 02:27:13 +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:
84
vendor/github.com/onsi/gomega/gstruct/fields.go
generated
vendored
84
vendor/github.com/onsi/gomega/gstruct/fields.go
generated
vendored
@@ -14,51 +14,53 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
//MatchAllFields succeeds if every field of a struct matches the field matcher associated with
|
||||
//it, and every element matcher is matched.
|
||||
// actual := struct{
|
||||
// A int
|
||||
// B []bool
|
||||
// C string
|
||||
// }{
|
||||
// A: 5,
|
||||
// B: []bool{true, false},
|
||||
// C: "foo",
|
||||
// }
|
||||
// MatchAllFields succeeds if every field of a struct matches the field matcher associated with
|
||||
// it, and every element matcher is matched.
|
||||
//
|
||||
// Expect(actual).To(MatchAllFields(Fields{
|
||||
// "A": Equal(5),
|
||||
// "B": ConsistOf(true, false),
|
||||
// "C": Equal("foo"),
|
||||
// }))
|
||||
// actual := struct{
|
||||
// A int
|
||||
// B []bool
|
||||
// C string
|
||||
// }{
|
||||
// A: 5,
|
||||
// B: []bool{true, false},
|
||||
// C: "foo",
|
||||
// }
|
||||
//
|
||||
// Expect(actual).To(MatchAllFields(Fields{
|
||||
// "A": Equal(5),
|
||||
// "B": ConsistOf(true, false),
|
||||
// "C": Equal("foo"),
|
||||
// }))
|
||||
func MatchAllFields(fields Fields) types.GomegaMatcher {
|
||||
return &FieldsMatcher{
|
||||
Fields: fields,
|
||||
}
|
||||
}
|
||||
|
||||
//MatchFields succeeds if each element of a struct matches the field matcher associated with
|
||||
//it. It can ignore extra fields and/or missing fields.
|
||||
// actual := struct{
|
||||
// A int
|
||||
// B []bool
|
||||
// C string
|
||||
// }{
|
||||
// A: 5,
|
||||
// B: []bool{true, false},
|
||||
// C: "foo",
|
||||
// }
|
||||
// MatchFields succeeds if each element of a struct matches the field matcher associated with
|
||||
// it. It can ignore extra fields and/or missing fields.
|
||||
//
|
||||
// Expect(actual).To(MatchFields(IgnoreExtras, Fields{
|
||||
// "A": Equal(5),
|
||||
// "B": ConsistOf(true, false),
|
||||
// }))
|
||||
// Expect(actual).To(MatchFields(IgnoreMissing, Fields{
|
||||
// "A": Equal(5),
|
||||
// "B": ConsistOf(true, false),
|
||||
// "C": Equal("foo"),
|
||||
// "D": Equal("extra"),
|
||||
// }))
|
||||
// actual := struct{
|
||||
// A int
|
||||
// B []bool
|
||||
// C string
|
||||
// }{
|
||||
// A: 5,
|
||||
// B: []bool{true, false},
|
||||
// C: "foo",
|
||||
// }
|
||||
//
|
||||
// Expect(actual).To(MatchFields(IgnoreExtras, Fields{
|
||||
// "A": Equal(5),
|
||||
// "B": ConsistOf(true, false),
|
||||
// }))
|
||||
// Expect(actual).To(MatchFields(IgnoreMissing, Fields{
|
||||
// "A": Equal(5),
|
||||
// "B": ConsistOf(true, false),
|
||||
// "C": Equal("foo"),
|
||||
// "D": Equal("extra"),
|
||||
// }))
|
||||
func MatchFields(options Options, fields Fields) types.GomegaMatcher {
|
||||
return &FieldsMatcher{
|
||||
Fields: fields,
|
||||
@@ -83,7 +85,7 @@ type FieldsMatcher struct {
|
||||
// Field name to matcher.
|
||||
type Fields map[string]types.GomegaMatcher
|
||||
|
||||
func (m *FieldsMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
func (m *FieldsMatcher) Match(actual any) (success bool, err error) {
|
||||
if reflect.TypeOf(actual).Kind() != reflect.Struct {
|
||||
return false, fmt.Errorf("%v is type %T, expected struct", actual, actual)
|
||||
}
|
||||
@@ -95,7 +97,7 @@ func (m *FieldsMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (m *FieldsMatcher) matchFields(actual interface{}) (errs []error) {
|
||||
func (m *FieldsMatcher) matchFields(actual any) (errs []error) {
|
||||
val := reflect.ValueOf(actual)
|
||||
typ := val.Type()
|
||||
fields := map[string]bool{}
|
||||
@@ -147,7 +149,7 @@ func (m *FieldsMatcher) matchFields(actual interface{}) (errs []error) {
|
||||
return errs
|
||||
}
|
||||
|
||||
func (m *FieldsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
func (m *FieldsMatcher) FailureMessage(actual any) (message string) {
|
||||
failures := make([]string, len(m.failures))
|
||||
for i := range m.failures {
|
||||
failures[i] = m.failures[i].Error()
|
||||
@@ -156,7 +158,7 @@ func (m *FieldsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
fmt.Sprintf("to match fields: {\n%v\n}\n", strings.Join(failures, "\n")))
|
||||
}
|
||||
|
||||
func (m *FieldsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
func (m *FieldsMatcher) NegatedFailureMessage(actual any) (message string) {
|
||||
return format.Message(actual, "not to match fields")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user