summaryrefslogtreecommitdiff
path: root/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2019-09-30 12:44:47 +0000
committerValentin Rothberg <rothberg@redhat.com>2019-10-01 17:14:55 +0200
commit6c72b5c5926fdaed67936f0b1c6f948e3bf5c441 (patch)
tree63d66b30f322695f79acf8650532a89d705d2e79 /vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
parentd7eba026876e4a6a362464dcf08fe6757ebedd1a (diff)
downloadpodman-6c72b5c5926fdaed67936f0b1c6f948e3bf5c441.tar.gz
podman-6c72b5c5926fdaed67936f0b1c6f948e3bf5c441.tar.bz2
podman-6c72b5c5926fdaed67936f0b1c6f948e3bf5c441.zip
Bump github.com/onsi/gomega from 1.5.0 to 1.7.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.5.0 to 1.7.0. - [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.5.0...v1.7.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go')
-rw-r--r--vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
index 4159335d0..8d6c44c7a 100644
--- a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
+++ b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
@@ -1,3 +1,5 @@
+// untested sections: 2
+
package matchers
import (
@@ -22,19 +24,21 @@ func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, e
}
value := reflect.ValueOf(actual)
- var keys []reflect.Value
+ var valueAt func(int) interface{}
if isMap(actual) {
- keys = value.MapKeys()
+ keys := value.MapKeys()
+ valueAt = func(i int) interface{} {
+ return value.MapIndex(keys[i]).Interface()
+ }
+ } else {
+ valueAt = func(i int) interface{} {
+ return value.Index(i).Interface()
+ }
}
+
var lastError error
for i := 0; i < value.Len(); i++ {
- var success bool
- var err error
- if isMap(actual) {
- success, err = elemMatcher.Match(value.MapIndex(keys[i]).Interface())
- } else {
- success, err = elemMatcher.Match(value.Index(i).Interface())
- }
+ success, err := elemMatcher.Match(valueAt(i))
if err != nil {
lastError = err
continue