rebase: Bump github.com/onsi/gomega from 1.27.4 to 1.27.6

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.4 to 1.27.6.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.4...v1.27.6)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2023-04-18 08:07:36 +00:00
committed by mergify[bot]
parent 7b44054a7e
commit 86a7acc2fb
7 changed files with 47 additions and 21 deletions

View File

@ -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
}
}