aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onsi/gomega/matchers
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/onsi/gomega/matchers')
-rw-r--r--vendor/github.com/onsi/gomega/matchers/and.go64
-rw-r--r--vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go31
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_a_directory.go54
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go54
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go38
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go45
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go26
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go33
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_false_matcher.go25
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_identical_to.go37
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go18
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go120
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go71
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go65
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_true_matcher.go25
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go27
-rw-r--r--vendor/github.com/onsi/gomega/matchers/consist_of.go80
-rw-r--r--vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go56
-rw-r--r--vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go37
-rw-r--r--vendor/github.com/onsi/gomega/matchers/equal_matcher.go33
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go28
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_key_matcher.go53
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go73
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_len_matcher.go27
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go33
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go35
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go35
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_error_matcher.go50
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_json_matcher.go64
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go42
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go74
-rw-r--r--vendor/github.com/onsi/gomega/matchers/not.go30
-rw-r--r--vendor/github.com/onsi/gomega/matchers/or.go67
-rw-r--r--vendor/github.com/onsi/gomega/matchers/panic_matcher.go46
-rw-r--r--vendor/github.com/onsi/gomega/matchers/receive_matcher.go126
-rw-r--r--vendor/github.com/onsi/gomega/matchers/succeed_matcher.go33
-rw-r--r--vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go41
-rw-r--r--vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go161
-rw-r--r--vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go61
-rw-r--r--vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go7
-rw-r--r--vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go7
-rw-r--r--vendor/github.com/onsi/gomega/matchers/type_support.go176
-rw-r--r--vendor/github.com/onsi/gomega/matchers/with_transform.go72
43 files changed, 0 insertions, 2280 deletions
diff --git a/vendor/github.com/onsi/gomega/matchers/and.go b/vendor/github.com/onsi/gomega/matchers/and.go
deleted file mode 100644
index 94c42a7..0000000
--- a/vendor/github.com/onsi/gomega/matchers/and.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package matchers
-
-import (
- "fmt"
-
- "github.com/onsi/gomega/format"
- "github.com/onsi/gomega/internal/oraclematcher"
- "github.com/onsi/gomega/types"
-)
-
-type AndMatcher struct {
- Matchers []types.GomegaMatcher
-
- // state
- firstFailedMatcher types.GomegaMatcher
-}
-
-func (m *AndMatcher) Match(actual interface{}) (success bool, err error) {
- m.firstFailedMatcher = nil
- for _, matcher := range m.Matchers {
- success, err := matcher.Match(actual)
- if !success || err != nil {
- m.firstFailedMatcher = matcher
- return false, err
- }
- }
- return true, nil
-}
-
-func (m *AndMatcher) FailureMessage(actual interface{}) (message string) {
- return m.firstFailedMatcher.FailureMessage(actual)
-}
-
-func (m *AndMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- // not the most beautiful list of matchers, but not bad either...
- return format.Message(actual, fmt.Sprintf("To not satisfy all of these matchers: %s", m.Matchers))
-}
-
-func (m *AndMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
- /*
- Example with 3 matchers: A, B, C
-
- Match evaluates them: T, F, <?> => F
- So match is currently F, what should MatchMayChangeInTheFuture() return?
- Seems like it only depends on B, since currently B MUST change to allow the result to become T
-
- Match eval: T, T, T => T
- So match is currently T, what should MatchMayChangeInTheFuture() return?
- Seems to depend on ANY of them being able to change to F.
- */
-
- if m.firstFailedMatcher == nil {
- // so all matchers succeeded.. Any one of them changing would change the result.
- for _, matcher := range m.Matchers {
- if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) {
- return true
- }
- }
- return false // none of were going to change
- } else {
- // one of the matchers failed.. it must be able to change in order to affect the result
- return oraclematcher.MatchMayChangeInTheFuture(m.firstFailedMatcher, actual)
- }
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go
deleted file mode 100644
index 89a1fc2..0000000
--- a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
-)
-
-type AssignableToTypeOfMatcher struct {
- Expected interface{}
-}
-
-func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) {
- if actual == nil || matcher.Expected == nil {
- return false, fmt.Errorf("Refusing to compare <nil> to <nil>.\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.")
- }
-
- actualType := reflect.TypeOf(actual)
- expectedType := reflect.TypeOf(matcher.Expected)
-
- return actualType.AssignableTo(expectedType), nil
-}
-
-func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string {
- return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected))
-}
-
-func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string {
- return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected))
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go b/vendor/github.com/onsi/gomega/matchers/be_a_directory.go
deleted file mode 100644
index 7b6975e..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "os"
-
- "github.com/onsi/gomega/format"
-)
-
-type notADirectoryError struct {
- os.FileInfo
-}
-
-func (t notADirectoryError) Error() string {
- fileInfo := os.FileInfo(t)
- switch {
- case fileInfo.Mode().IsRegular():
- return "file is a regular file"
- default:
- return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String())
- }
-}
-
-type BeADirectoryMatcher struct {
- expected interface{}
- err error
-}
-
-func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) {
- actualFilename, ok := actual.(string)
- if !ok {
- return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path")
- }
-
- fileInfo, err := os.Stat(actualFilename)
- if err != nil {
- matcher.err = err
- return false, nil
- }
-
- if !fileInfo.Mode().IsDir() {
- matcher.err = notADirectoryError{fileInfo}
- return false, nil
- }
- return true, nil
-}
-
-func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err))
-}
-
-func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("not be a directory"))
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go
deleted file mode 100644
index e239131..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "os"
-
- "github.com/onsi/gomega/format"
-)
-
-type notARegularFileError struct {
- os.FileInfo
-}
-
-func (t notARegularFileError) Error() string {
- fileInfo := os.FileInfo(t)
- switch {
- case fileInfo.IsDir():
- return "file is a directory"
- default:
- return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String())
- }
-}
-
-type BeARegularFileMatcher struct {
- expected interface{}
- err error
-}
-
-func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) {
- actualFilename, ok := actual.(string)
- if !ok {
- return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path")
- }
-
- fileInfo, err := os.Stat(actualFilename)
- if err != nil {
- matcher.err = err
- return false, nil
- }
-
- if !fileInfo.Mode().IsRegular() {
- matcher.err = notARegularFileError{fileInfo}
- return false, nil
- }
- return true, nil
-}
-
-func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err))
-}
-
-func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("not be a regular file"))
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go
deleted file mode 100644
index d42eba2..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "os"
-
- "github.com/onsi/gomega/format"
-)
-
-type BeAnExistingFileMatcher struct {
- expected interface{}
-}
-
-func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) {
- actualFilename, ok := actual.(string)
- if !ok {
- return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path")
- }
-
- if _, err = os.Stat(actualFilename); err != nil {
- switch {
- case os.IsNotExist(err):
- return false, nil
- default:
- return false, err
- }
- }
-
- return true, nil
-}
-
-func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("to exist"))
-}
-
-func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("not to exist"))
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go
deleted file mode 100644
index c1b4995..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "reflect"
-)
-
-type BeClosedMatcher struct {
-}
-
-func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) {
- if !isChan(actual) {
- return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1))
- }
-
- channelType := reflect.TypeOf(actual)
- channelValue := reflect.ValueOf(actual)
-
- if channelType.ChanDir() == reflect.SendDir {
- return false, fmt.Errorf("BeClosed matcher cannot determine if a send-only channel is closed or open. Got:\n%s", format.Object(actual, 1))
- }
-
- winnerIndex, _, open := reflect.Select([]reflect.SelectCase{
- reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue},
- reflect.SelectCase{Dir: reflect.SelectDefault},
- })
-
- var closed bool
- if winnerIndex == 0 {
- closed = !open
- } else if winnerIndex == 1 {
- closed = false
- }
-
- return closed, nil
-}
-
-func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be closed")
-}
-
-func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be open")
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go
deleted file mode 100644
index 55bdd7d..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
-)
-
-type BeEmptyMatcher struct {
-}
-
-func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) {
- length, ok := lengthOf(actual)
- if !ok {
- return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1))
- }
-
- return length == 0, nil
-}
-
-func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be empty")
-}
-
-func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to be empty")
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go
deleted file mode 100644
index 32a0c31..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "reflect"
-)
-
-type BeEquivalentToMatcher struct {
- Expected interface{}
-}
-
-func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) {
- if actual == nil && matcher.Expected == nil {
- return false, fmt.Errorf("Both actual and expected must not be nil.")
- }
-
- convertedActual := actual
-
- if actual != nil && matcher.Expected != nil && reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(matcher.Expected)) {
- convertedActual = reflect.ValueOf(actual).Convert(reflect.TypeOf(matcher.Expected)).Interface()
- }
-
- return reflect.DeepEqual(convertedActual, matcher.Expected), nil
-}
-
-func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be equivalent to", matcher.Expected)
-}
-
-func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to be equivalent to", matcher.Expected)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go
deleted file mode 100644
index 0b224cb..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
-)
-
-type BeFalseMatcher struct {
-}
-
-func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) {
- if !isBool(actual) {
- return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1))
- }
-
- return actual == false, nil
-}
-
-func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be false")
-}
-
-func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to be false")
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_identical_to.go b/vendor/github.com/onsi/gomega/matchers/be_identical_to.go
deleted file mode 100644
index fdcda4d..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_identical_to.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "runtime"
-
- "github.com/onsi/gomega/format"
-)
-
-type BeIdenticalToMatcher struct {
- Expected interface{}
-}
-
-func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) {
- if actual == nil && matcher.Expected == nil {
- return false, fmt.Errorf("Refusing to compare <nil> to <nil>.\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.")
- }
-
- defer func() {
- if r := recover(); r != nil {
- if _, ok := r.(runtime.Error); ok {
- success = false
- matchErr = nil
- }
- }
- }()
-
- return actual == matcher.Expected, nil
-}
-
-func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string {
- return format.Message(actual, "to be identical to", matcher.Expected)
-}
-
-func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string {
- return format.Message(actual, "not to be identical to", matcher.Expected)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go
deleted file mode 100644
index 7ee84fe..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package matchers
-
-import "github.com/onsi/gomega/format"
-
-type BeNilMatcher struct {
-}
-
-func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) {
- return isNil(actual), nil
-}
-
-func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be nil")
-}
-
-func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to be nil")
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go
deleted file mode 100644
index 0c157f6..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "math"
-
- "github.com/onsi/gomega/format"
-)
-
-type BeNumericallyMatcher struct {
- Comparator string
- CompareTo []interface{}
-}
-
-func (matcher *BeNumericallyMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo[0])
-}
-
-func (matcher *BeNumericallyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo[0])
-}
-
-func (matcher *BeNumericallyMatcher) Match(actual interface{}) (success bool, err error) {
- if len(matcher.CompareTo) == 0 || len(matcher.CompareTo) > 2 {
- return false, fmt.Errorf("BeNumerically requires 1 or 2 CompareTo arguments. Got:\n%s", format.Object(matcher.CompareTo, 1))
- }
- if !isNumber(actual) {
- return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(actual, 1))
- }
- if !isNumber(matcher.CompareTo[0]) {
- return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1))
- }
- if len(matcher.CompareTo) == 2 && !isNumber(matcher.CompareTo[1]) {
- return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1))
- }
-
- switch matcher.Comparator {
- case "==", "~", ">", ">=", "<", "<=":
- default:
- return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator)
- }
-
- if isFloat(actual) || isFloat(matcher.CompareTo[0]) {
- var secondOperand float64 = 1e-8
- if len(matcher.CompareTo) == 2 {
- secondOperand = toFloat(matcher.CompareTo[1])
- }
- success = matcher.matchFloats(toFloat(actual), toFloat(matcher.CompareTo[0]), secondOperand)
- } else if isInteger(actual) {
- var secondOperand int64 = 0
- if len(matcher.CompareTo) == 2 {
- secondOperand = toInteger(matcher.CompareTo[1])
- }
- success = matcher.matchIntegers(toInteger(actual), toInteger(matcher.CompareTo[0]), secondOperand)
- } else if isUnsignedInteger(actual) {
- var secondOperand uint64 = 0
- if len(matcher.CompareTo) == 2 {
- secondOperand = toUnsignedInteger(matcher.CompareTo[1])
- }
- success = matcher.matchUnsignedIntegers(toUnsignedInteger(actual), toUnsignedInteger(matcher.CompareTo[0]), secondOperand)
- } else {
- return false, fmt.Errorf("Failed to compare:\n%s\n%s:\n%s", format.Object(actual, 1), matcher.Comparator, format.Object(matcher.CompareTo[0], 1))
- }
-
- return success, nil
-}
-
-func (matcher *BeNumericallyMatcher) matchIntegers(actual, compareTo, threshold int64) (success bool) {
- switch matcher.Comparator {
- case "==", "~":
- diff := actual - compareTo
- return -threshold <= diff && diff <= threshold
- case ">":
- return (actual > compareTo)
- case ">=":
- return (actual >= compareTo)
- case "<":
- return (actual < compareTo)
- case "<=":
- return (actual <= compareTo)
- }
- return false
-}
-
-func (matcher *BeNumericallyMatcher) matchUnsignedIntegers(actual, compareTo, threshold uint64) (success bool) {
- switch matcher.Comparator {
- case "==", "~":
- if actual < compareTo {
- actual, compareTo = compareTo, actual
- }
- return actual-compareTo <= threshold
- case ">":
- return (actual > compareTo)
- case ">=":
- return (actual >= compareTo)
- case "<":
- return (actual < compareTo)
- case "<=":
- return (actual <= compareTo)
- }
- return false
-}
-
-func (matcher *BeNumericallyMatcher) matchFloats(actual, compareTo, threshold float64) (success bool) {
- switch matcher.Comparator {
- case "~":
- return math.Abs(actual-compareTo) <= threshold
- case "==":
- return (actual == compareTo)
- case ">":
- return (actual > compareTo)
- case ">=":
- return (actual >= compareTo)
- case "<":
- return (actual < compareTo)
- case "<=":
- return (actual <= compareTo)
- }
- return false
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go
deleted file mode 100644
index d7c3223..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
-)
-
-type BeSentMatcher struct {
- Arg interface{}
- channelClosed bool
-}
-
-func (matcher *BeSentMatcher) Match(actual interface{}) (success bool, err error) {
- if !isChan(actual) {
- return false, fmt.Errorf("BeSent expects a channel. Got:\n%s", format.Object(actual, 1))
- }
-
- channelType := reflect.TypeOf(actual)
- channelValue := reflect.ValueOf(actual)
-
- if channelType.ChanDir() == reflect.RecvDir {
- return false, fmt.Errorf("BeSent matcher cannot be passed a receive-only channel. Got:\n%s", format.Object(actual, 1))
- }
-
- argType := reflect.TypeOf(matcher.Arg)
- assignable := argType.AssignableTo(channelType.Elem())
-
- if !assignable {
- return false, fmt.Errorf("Cannot pass:\n%s to the channel:\n%s\nThe types don't match.", format.Object(matcher.Arg, 1), format.Object(actual, 1))
- }
-
- argValue := reflect.ValueOf(matcher.Arg)
-
- defer func() {
- if e := recover(); e != nil {
- success = false
- err = fmt.Errorf("Cannot send to a closed channel")
- matcher.channelClosed = true
- }
- }()
-
- winnerIndex, _, _ := reflect.Select([]reflect.SelectCase{
- reflect.SelectCase{Dir: reflect.SelectSend, Chan: channelValue, Send: argValue},
- reflect.SelectCase{Dir: reflect.SelectDefault},
- })
-
- var didSend bool
- if winnerIndex == 0 {
- didSend = true
- }
-
- return didSend, nil
-}
-
-func (matcher *BeSentMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to send:", matcher.Arg)
-}
-
-func (matcher *BeSentMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to send:", matcher.Arg)
-}
-
-func (matcher *BeSentMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
- if !isChan(actual) {
- return false
- }
-
- return !matcher.channelClosed
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go
deleted file mode 100644
index abda4eb..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "time"
-)
-
-type BeTemporallyMatcher struct {
- Comparator string
- CompareTo time.Time
- Threshold []time.Duration
-}
-
-func (matcher *BeTemporallyMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo)
-}
-
-func (matcher *BeTemporallyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo)
-}
-
-func (matcher *BeTemporallyMatcher) Match(actual interface{}) (bool, error) {
- // predicate to test for time.Time type
- isTime := func(t interface{}) bool {
- _, ok := t.(time.Time)
- return ok
- }
-
- if !isTime(actual) {
- return false, fmt.Errorf("Expected a time.Time. Got:\n%s", format.Object(actual, 1))
- }
-
- switch matcher.Comparator {
- case "==", "~", ">", ">=", "<", "<=":
- default:
- return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator)
- }
-
- var threshold = time.Millisecond
- if len(matcher.Threshold) == 1 {
- threshold = matcher.Threshold[0]
- }
-
- return matcher.matchTimes(actual.(time.Time), matcher.CompareTo, threshold), nil
-}
-
-func (matcher *BeTemporallyMatcher) matchTimes(actual, compareTo time.Time, threshold time.Duration) (success bool) {
- switch matcher.Comparator {
- case "==":
- return actual.Equal(compareTo)
- case "~":
- diff := actual.Sub(compareTo)
- return -threshold <= diff && diff <= threshold
- case ">":
- return actual.After(compareTo)
- case ">=":
- return !actual.Before(compareTo)
- case "<":
- return actual.Before(compareTo)
- case "<=":
- return !actual.After(compareTo)
- }
- return false
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go
deleted file mode 100644
index 1275e5f..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
-)
-
-type BeTrueMatcher struct {
-}
-
-func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) {
- if !isBool(actual) {
- return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1))
- }
-
- return actual.(bool), nil
-}
-
-func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be true")
-}
-
-func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to be true")
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go
deleted file mode 100644
index b39c914..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package matchers
-
-import (
- "github.com/onsi/gomega/format"
- "reflect"
-)
-
-type BeZeroMatcher struct {
-}
-
-func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) {
- if actual == nil {
- return true, nil
- }
- zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface()
-
- return reflect.DeepEqual(zeroValue, actual), nil
-
-}
-
-func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to be zero-valued")
-}
-
-func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to be zero-valued")
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/consist_of.go b/vendor/github.com/onsi/gomega/matchers/consist_of.go
deleted file mode 100644
index 7b0e088..0000000
--- a/vendor/github.com/onsi/gomega/matchers/consist_of.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
- "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph"
-)
-
-type ConsistOfMatcher struct {
- Elements []interface{}
-}
-
-func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) {
- if !isArrayOrSlice(actual) && !isMap(actual) {
- return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1))
- }
-
- elements := matcher.Elements
- if len(matcher.Elements) == 1 && isArrayOrSlice(matcher.Elements[0]) {
- elements = []interface{}{}
- value := reflect.ValueOf(matcher.Elements[0])
- for i := 0; i < value.Len(); i++ {
- elements = append(elements, value.Index(i).Interface())
- }
- }
-
- matchers := []interface{}{}
- for _, element := range elements {
- matcher, isMatcher := element.(omegaMatcher)
- if !isMatcher {
- matcher = &EqualMatcher{Expected: element}
- }
- matchers = append(matchers, matcher)
- }
-
- values := matcher.valuesOf(actual)
-
- if len(values) != len(matchers) {
- return false, nil
- }
-
- neighbours := func(v, m interface{}) (bool, error) {
- match, err := m.(omegaMatcher).Match(v)
- return match && err == nil, nil
- }
-
- bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(values, matchers, neighbours)
- if err != nil {
- return false, err
- }
-
- return len(bipartiteGraph.LargestMatching()) == len(values), nil
-}
-
-func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} {
- value := reflect.ValueOf(actual)
- values := []interface{}{}
- if isMap(actual) {
- keys := value.MapKeys()
- for i := 0; i < value.Len(); i++ {
- values = append(values, value.MapIndex(keys[i]).Interface())
- }
- } else {
- for i := 0; i < value.Len(); i++ {
- values = append(values, value.Index(i).Interface())
- }
- }
-
- return values
-}
-
-func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to consist of", matcher.Elements)
-}
-
-func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to consist of", matcher.Elements)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
deleted file mode 100644
index 4159335..0000000
--- a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
-)
-
-type ContainElementMatcher struct {
- Element interface{}
-}
-
-func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) {
- if !isArrayOrSlice(actual) && !isMap(actual) {
- return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1))
- }
-
- elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher)
- if !elementIsMatcher {
- elemMatcher = &EqualMatcher{Expected: matcher.Element}
- }
-
- value := reflect.ValueOf(actual)
- var keys []reflect.Value
- if isMap(actual) {
- keys = value.MapKeys()
- }
- 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())
- }
- if err != nil {
- lastError = err
- continue
- }
- if success {
- return true, nil
- }
- }
-
- return false, lastError
-}
-
-func (matcher *ContainElementMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to contain element matching", matcher.Element)
-}
-
-func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to contain element matching", matcher.Element)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go
deleted file mode 100644
index 2e76089..0000000
--- a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "strings"
-)
-
-type ContainSubstringMatcher struct {
- Substr string
- Args []interface{}
-}
-
-func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) {
- actualString, ok := toString(actual)
- if !ok {
- return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1))
- }
-
- return strings.Contains(actualString, matcher.stringToMatch()), nil
-}
-
-func (matcher *ContainSubstringMatcher) stringToMatch() string {
- stringToMatch := matcher.Substr
- if len(matcher.Args) > 0 {
- stringToMatch = fmt.Sprintf(matcher.Substr, matcher.Args...)
- }
- return stringToMatch
-}
-
-func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to contain substring", matcher.stringToMatch())
-}
-
-func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to contain substring", matcher.stringToMatch())
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/equal_matcher.go b/vendor/github.com/onsi/gomega/matchers/equal_matcher.go
deleted file mode 100644
index 874e6a6..0000000
--- a/vendor/github.com/onsi/gomega/matchers/equal_matcher.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
-)
-
-type EqualMatcher struct {
- Expected interface{}
-}
-
-func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) {
- if actual == nil && matcher.Expected == nil {
- return false, fmt.Errorf("Refusing to compare <nil> to <nil>.\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.")
- }
- return reflect.DeepEqual(actual, matcher.Expected), nil
-}
-
-func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) {
- actualString, actualOK := actual.(string)
- expectedString, expectedOK := matcher.Expected.(string)
- if actualOK && expectedOK {
- return format.MessageWithDiff(actualString, "to equal", expectedString)
- }
-
- return format.Message(actual, "to equal", matcher.Expected)
-}
-
-func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to equal", matcher.Expected)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go
deleted file mode 100644
index 7ace93d..0000000
--- a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package matchers
-
-import (
- "fmt"
-
- "github.com/onsi/gomega/format"
-)
-
-type HaveCapMatcher struct {
- Count int
-}
-
-func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) {
- length, ok := capOf(actual)
- if !ok {
- return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1))
- }
-
- return length == matcher.Count, nil
-}
-
-func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) {
- return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count)
-}
-
-func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go
deleted file mode 100644
index 5701ba6..0000000
--- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "reflect"
-)
-
-type HaveKeyMatcher struct {
- Key interface{}
-}
-
-func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) {
- if !isMap(actual) {
- return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1))
- }
-
- keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher)
- if !keyIsMatcher {
- keyMatcher = &EqualMatcher{Expected: matcher.Key}
- }
-
- keys := reflect.ValueOf(actual).MapKeys()
- for i := 0; i < len(keys); i++ {
- success, err := keyMatcher.Match(keys[i].Interface())
- if err != nil {
- return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error())
- }
- if success {
- return true, nil
- }
- }
-
- return false, nil
-}
-
-func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message string) {
- switch matcher.Key.(type) {
- case omegaMatcher:
- return format.Message(actual, "to have key matching", matcher.Key)
- default:
- return format.Message(actual, "to have key", matcher.Key)
- }
-}
-
-func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- switch matcher.Key.(type) {
- case omegaMatcher:
- return format.Message(actual, "not to have key matching", matcher.Key)
- default:
- return format.Message(actual, "not to have key", matcher.Key)
- }
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go
deleted file mode 100644
index 464ac18..0000000
--- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "reflect"
-)
-
-type HaveKeyWithValueMatcher struct {
- Key interface{}
- Value interface{}
-}
-
-func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, err error) {
- if !isMap(actual) {
- return false, fmt.Errorf("HaveKeyWithValue matcher expects a map. Got:%s", format.Object(actual, 1))
- }
-
- keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher)
- if !keyIsMatcher {
- keyMatcher = &EqualMatcher{Expected: matcher.Key}
- }
-
- valueMatcher, valueIsMatcher := matcher.Value.(omegaMatcher)
- if !valueIsMatcher {
- valueMatcher = &EqualMatcher{Expected: matcher.Value}
- }
-
- keys := reflect.ValueOf(actual).MapKeys()
- for i := 0; i < len(keys); i++ {
- success, err := keyMatcher.Match(keys[i].Interface())
- if err != nil {
- return false, fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error())
- }
- if success {
- actualValue := reflect.ValueOf(actual).MapIndex(keys[i])
- success, err := valueMatcher.Match(actualValue.Interface())
- if err != nil {
- return false, fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error())
- }
- return success, nil
- }
- }
-
- return false, nil
-}
-
-func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual interface{}) (message string) {
- str := "to have {key: value}"
- if _, ok := matcher.Key.(omegaMatcher); ok {
- str += " matching"
- } else if _, ok := matcher.Value.(omegaMatcher); ok {
- str += " matching"
- }
-
- expect := make(map[interface{}]interface{}, 1)
- expect[matcher.Key] = matcher.Value
- return format.Message(actual, str, expect)
-}
-
-func (matcher *HaveKeyWithValueMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- kStr := "not to have key"
- if _, ok := matcher.Key.(omegaMatcher); ok {
- kStr = "not to have key matching"
- }
-
- vStr := "or that key's value not be"
- if _, ok := matcher.Value.(omegaMatcher); ok {
- vStr = "or to have that key's value not matching"
- }
-
- return format.Message(actual, kStr, matcher.Key, vStr, matcher.Value)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go
deleted file mode 100644
index a183775..0000000
--- a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
-)
-
-type HaveLenMatcher struct {
- Count int
-}
-
-func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) {
- length, ok := lengthOf(actual)
- if !ok {
- return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1))
- }
-
- return length == matcher.Count, nil
-}
-
-func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) {
- return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count)
-}
-
-func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go
deleted file mode 100644
index ebdd717..0000000
--- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package matchers
-
-import (
- "fmt"
-
- "github.com/onsi/gomega/format"
-)
-
-type HaveOccurredMatcher struct {
-}
-
-func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) {
- // is purely nil?
- if actual == nil {
- return false, nil
- }
-
- // must be an 'error' type
- if !isError(actual) {
- return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1))
- }
-
- // must be non-nil (or a pointer to a non-nil)
- return !isNil(actual), nil
-}
-
-func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) {
- return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1))
-}
-
-func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred")
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go
deleted file mode 100644
index 8b63a89..0000000
--- a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
-)
-
-type HavePrefixMatcher struct {
- Prefix string
- Args []interface{}
-}
-
-func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) {
- actualString, ok := toString(actual)
- if !ok {
- return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1))
- }
- prefix := matcher.prefix()
- return len(actualString) >= len(prefix) && actualString[0:len(prefix)] == prefix, nil
-}
-
-func (matcher *HavePrefixMatcher) prefix() string {
- if len(matcher.Args) > 0 {
- return fmt.Sprintf(matcher.Prefix, matcher.Args...)
- }
- return matcher.Prefix
-}
-
-func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to have prefix", matcher.prefix())
-}
-
-func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to have prefix", matcher.prefix())
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go
deleted file mode 100644
index afc78fc..0000000
--- a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
-)
-
-type HaveSuffixMatcher struct {
- Suffix string
- Args []interface{}
-}
-
-func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) {
- actualString, ok := toString(actual)
- if !ok {
- return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1))
- }
- suffix := matcher.suffix()
- return len(actualString) >= len(suffix) && actualString[len(actualString)-len(suffix):] == suffix, nil
-}
-
-func (matcher *HaveSuffixMatcher) suffix() string {
- if len(matcher.Args) > 0 {
- return fmt.Sprintf(matcher.Suffix, matcher.Args...)
- }
- return matcher.Suffix
-}
-
-func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to have suffix", matcher.suffix())
-}
-
-func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to have suffix", matcher.suffix())
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
deleted file mode 100644
index 03cdf04..0000000
--- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "reflect"
-)
-
-type MatchErrorMatcher struct {
- Expected interface{}
-}
-
-func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) {
- if isNil(actual) {
- return false, fmt.Errorf("Expected an error, got nil")
- }
-
- if !isError(actual) {
- return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1))
- }
-
- actualErr := actual.(error)
-
- if isString(matcher.Expected) {
- return reflect.DeepEqual(actualErr.Error(), matcher.Expected), nil
- }
-
- if isError(matcher.Expected) {
- return reflect.DeepEqual(actualErr, matcher.Expected), nil
- }
-
- var subMatcher omegaMatcher
- var hasSubMatcher bool
- if matcher.Expected != nil {
- subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher)
- if hasSubMatcher {
- return subMatcher.Match(actualErr.Error())
- }
- }
-
- return false, fmt.Errorf("MatchError must be passed an error, string, or Matcher that can match on strings. Got:\n%s", format.Object(matcher.Expected, 1))
-}
-
-func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to match error", matcher.Expected)
-}
-
-func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to match error", matcher.Expected)
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go
deleted file mode 100644
index e61978a..0000000
--- a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package matchers
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
-)
-
-type MatchJSONMatcher struct {
- JSONToMatch interface{}
-}
-
-func (matcher *MatchJSONMatcher) Match(actual interface{}) (success bool, err error) {
- actualString, expectedString, err := matcher.prettyPrint(actual)
- if err != nil {
- return false, err
- }
-
- var aval interface{}
- var eval interface{}
-
- // this is guarded by prettyPrint
- json.Unmarshal([]byte(actualString), &aval)
- json.Unmarshal([]byte(expectedString), &eval)
-
- return reflect.DeepEqual(aval, eval), nil
-}
-
-func (matcher *MatchJSONMatcher) FailureMessage(actual interface{}) (message string) {
- actualString, expectedString, _ := matcher.prettyPrint(actual)
- return format.Message(actualString, "to match JSON of", expectedString)
-}
-
-func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- actualString, expectedString, _ := matcher.prettyPrint(actual)
- return format.Message(actualString, "not to match JSON of", expectedString)
-}
-
-func (matcher *MatchJSONMatcher) prettyPrint(actual interface{}) (actualFormatted, expectedFormatted string, err error) {
- actualString, ok := toString(actual)
- if !ok {
- return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1))
- }
- expectedString, ok := toString(matcher.JSONToMatch)
- if !ok {
- return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.JSONToMatch, 1))
- }
-
- abuf := new(bytes.Buffer)
- ebuf := new(bytes.Buffer)
-
- if err := json.Indent(abuf, []byte(actualString), "", " "); err != nil {
- return "", "", fmt.Errorf("Actual '%s' should be valid JSON, but it is not.\nUnderlying error:%s", actualString, err)
- }
-
- if err := json.Indent(ebuf, []byte(expectedString), "", " "); err != nil {
- return "", "", fmt.Errorf("Expected '%s' should be valid JSON, but it is not.\nUnderlying error:%s", expectedString, err)
- }
-
- return abuf.String(), ebuf.String(), nil
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go
deleted file mode 100644
index 7ca79a1..0000000
--- a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "github.com/onsi/gomega/format"
- "regexp"
-)
-
-type MatchRegexpMatcher struct {
- Regexp string
- Args []interface{}
-}
-
-func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) {
- actualString, ok := toString(actual)
- if !ok {
- return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1))
- }
-
- match, err := regexp.Match(matcher.regexp(), []byte(actualString))
- if err != nil {
- return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error())
- }
-
- return match, nil
-}
-
-func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to match regular expression", matcher.regexp())
-}
-
-func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to match regular expression", matcher.regexp())
-}
-
-func (matcher *MatchRegexpMatcher) regexp() string {
- re := matcher.Regexp
- if len(matcher.Args) > 0 {
- re = fmt.Sprintf(matcher.Regexp, matcher.Args...)
- }
- return re
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go
deleted file mode 100644
index 69fb51a..0000000
--- a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
- "strings"
-
- "github.com/onsi/gomega/format"
- "gopkg.in/yaml.v2"
-)
-
-type MatchYAMLMatcher struct {
- YAMLToMatch interface{}
-}
-
-func (matcher *MatchYAMLMatcher) Match(actual interface{}) (success bool, err error) {
- actualString, expectedString, err := matcher.toStrings(actual)
- if err != nil {
- return false, err
- }
-
- var aval interface{}
- var eval interface{}
-
- if err := yaml.Unmarshal([]byte(actualString), &aval); err != nil {
- return false, fmt.Errorf("Actual '%s' should be valid YAML, but it is not.\nUnderlying error:%s", actualString, err)
- }
- if err := yaml.Unmarshal([]byte(expectedString), &eval); err != nil {
- return false, fmt.Errorf("Expected '%s' should be valid YAML, but it is not.\nUnderlying error:%s", expectedString, err)
- }
-
- return reflect.DeepEqual(aval, eval), nil
-}
-
-func (matcher *MatchYAMLMatcher) FailureMessage(actual interface{}) (message string) {
- actualString, expectedString, _ := matcher.toNormalisedStrings(actual)
- return format.Message(actualString, "to match YAML of", expectedString)
-}
-
-func (matcher *MatchYAMLMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- actualString, expectedString, _ := matcher.toNormalisedStrings(actual)
- return format.Message(actualString, "not to match YAML of", expectedString)
-}
-
-func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) {
- actualString, expectedString, err := matcher.toStrings(actual)
- return normalise(actualString), normalise(expectedString), err
-}
-
-func normalise(input string) string {
- var val interface{}
- err := yaml.Unmarshal([]byte(input), &val)
- if err != nil {
- panic(err) // guarded by Match
- }
- output, err := yaml.Marshal(val)
- if err != nil {
- panic(err) // guarded by Unmarshal
- }
- return strings.TrimSpace(string(output))
-}
-
-func (matcher *MatchYAMLMatcher) toStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) {
- actualString, ok := toString(actual)
- if !ok {
- return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1))
- }
- expectedString, ok := toString(matcher.YAMLToMatch)
- if !ok {
- return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.YAMLToMatch, 1))
- }
-
- return actualString, expectedString, nil
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/not.go b/vendor/github.com/onsi/gomega/matchers/not.go
deleted file mode 100644
index 2c91670..0000000
--- a/vendor/github.com/onsi/gomega/matchers/not.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package matchers
-
-import (
- "github.com/onsi/gomega/internal/oraclematcher"
- "github.com/onsi/gomega/types"
-)
-
-type NotMatcher struct {
- Matcher types.GomegaMatcher
-}
-
-func (m *NotMatcher) Match(actual interface{}) (bool, error) {
- success, err := m.Matcher.Match(actual)
- if err != nil {
- return false, err
- }
- return !success, nil
-}
-
-func (m *NotMatcher) FailureMessage(actual interface{}) (message string) {
- return m.Matcher.NegatedFailureMessage(actual) // works beautifully
-}
-
-func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return m.Matcher.FailureMessage(actual) // works beautifully
-}
-
-func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
- return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/or.go b/vendor/github.com/onsi/gomega/matchers/or.go
deleted file mode 100644
index 3bf7998..0000000
--- a/vendor/github.com/onsi/gomega/matchers/or.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package matchers
-
-import (
- "fmt"
-
- "github.com/onsi/gomega/format"
- "github.com/onsi/gomega/internal/oraclematcher"
- "github.com/onsi/gomega/types"
-)
-
-type OrMatcher struct {
- Matchers []types.GomegaMatcher
-
- // state
- firstSuccessfulMatcher types.GomegaMatcher
-}
-
-func (m *OrMatcher) Match(actual interface{}) (success bool, err error) {
- m.firstSuccessfulMatcher = nil
- for _, matcher := range m.Matchers {
- success, err := matcher.Match(actual)
- if err != nil {
- return false, err
- }
- if success {
- m.firstSuccessfulMatcher = matcher
- return true, nil
- }
- }
- return false, nil
-}
-
-func (m *OrMatcher) FailureMessage(actual interface{}) (message string) {
- // not the most beautiful list of matchers, but not bad either...
- return format.Message(actual, fmt.Sprintf("To satisfy at least one of these matchers: %s", m.Matchers))
-}
-
-func (m *OrMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return m.firstSuccessfulMatcher.NegatedFailureMessage(actual)
-}
-
-func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
- /*
- Example with 3 matchers: A, B, C
-
- Match evaluates them: F, T, <?> => T
- So match is currently T, what should MatchMayChangeInTheFuture() return?
- Seems like it only depends on B, since currently B MUST change to allow the result to become F
-
- Match eval: F, F, F => F
- So match is currently F, what should MatchMayChangeInTheFuture() return?
- Seems to depend on ANY of them being able to change to T.
- */
-
- if m.firstSuccessfulMatcher != nil {
- // one of the matchers succeeded.. it must be able to change in order to affect the result
- return oraclematcher.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual)
- } else {
- // so all matchers failed.. Any one of them changing would change the result.
- for _, matcher := range m.Matchers {
- if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) {
- return true
- }
- }
- return false // none of were going to change
- }
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go b/vendor/github.com/onsi/gomega/matchers/panic_matcher.go
deleted file mode 100644
index 640f4db..0000000
--- a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
-)
-
-type PanicMatcher struct {
- object interface{}
-}
-
-func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) {
- if actual == nil {
- return false, fmt.Errorf("PanicMatcher expects a non-nil actual.")
- }
-
- actualType := reflect.TypeOf(actual)
- if actualType.Kind() != reflect.Func {
- return false, fmt.Errorf("PanicMatcher expects a function. Got:\n%s", format.Object(actual, 1))
- }
- if !(actualType.NumIn() == 0 && actualType.NumOut() == 0) {
- return false, fmt.Errorf("PanicMatcher expects a function with no arguments and no return value. Got:\n%s", format.Object(actual, 1))
- }
-
- success = false
- defer func() {
- if e := recover(); e != nil {
- matcher.object = e
- success = true
- }
- }()
-
- reflect.ValueOf(actual).Call([]reflect.Value{})
-
- return
-}
-
-func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to panic")
-}
-
-func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1)))
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go
deleted file mode 100644
index 7a8c2cd..0000000
--- a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
-)
-
-type ReceiveMatcher struct {
- Arg interface{}
- receivedValue reflect.Value
- channelClosed bool
-}
-
-func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err error) {
- if !isChan(actual) {
- return false, fmt.Errorf("ReceiveMatcher expects a channel. Got:\n%s", format.Object(actual, 1))
- }
-
- channelType := reflect.TypeOf(actual)
- channelValue := reflect.ValueOf(actual)
-
- if channelType.ChanDir() == reflect.SendDir {
- return false, fmt.Errorf("ReceiveMatcher matcher cannot be passed a send-only channel. Got:\n%s", format.Object(actual, 1))
- }
-
- var subMatcher omegaMatcher
- var hasSubMatcher bool
-
- if matcher.Arg != nil {
- subMatcher, hasSubMatcher = (matcher.Arg).(omegaMatcher)
- if !hasSubMatcher {
- argType := reflect.TypeOf(matcher.Arg)
- if argType.Kind() != reflect.Ptr {
- return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s\nYou need to pass a pointer!", format.Object(actual, 1), format.Object(matcher.Arg, 1))
- }
-
- assignable := channelType.Elem().AssignableTo(argType.Elem())
- if !assignable {
- return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s", format.Object(actual, 1), format.Object(matcher.Arg, 1))
- }
- }
- }
-
- winnerIndex, value, open := reflect.Select([]reflect.SelectCase{
- reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue},
- reflect.SelectCase{Dir: reflect.SelectDefault},
- })
-
- var closed bool
- var didReceive bool
- if winnerIndex == 0 {
- closed = !open
- didReceive = open
- }
- matcher.channelClosed = closed
-
- if closed {
- return false, nil
- }
-
- if hasSubMatcher {
- if didReceive {
- matcher.receivedValue = value
- return subMatcher.Match(matcher.receivedValue.Interface())
- } else {
- return false, nil
- }
- }
-
- if didReceive {
- if matcher.Arg != nil {
- outValue := reflect.ValueOf(matcher.Arg)
- reflect.Indirect(outValue).Set(value)
- }
-
- return true, nil
- } else {
- return false, nil
- }
-}
-
-func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message string) {
- subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher)
-
- closedAddendum := ""
- if matcher.channelClosed {
- closedAddendum = " The channel is closed."
- }
-
- if hasSubMatcher {
- if matcher.receivedValue.IsValid() {
- return subMatcher.FailureMessage(matcher.receivedValue.Interface())
- }
- return "When passed a matcher, ReceiveMatcher's channel *must* receive something."
- } else {
- return format.Message(actual, "to receive something."+closedAddendum)
- }
-}
-
-func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher)
-
- closedAddendum := ""
- if matcher.channelClosed {
- closedAddendum = " The channel is closed."
- }
-
- if hasSubMatcher {
- if matcher.receivedValue.IsValid() {
- return subMatcher.NegatedFailureMessage(matcher.receivedValue.Interface())
- }
- return "When passed a matcher, ReceiveMatcher's channel *must* receive something."
- } else {
- return format.Message(actual, "not to receive anything."+closedAddendum)
- }
-}
-
-func (matcher *ReceiveMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
- if !isChan(actual) {
- return false
- }
-
- return !matcher.channelClosed
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go
deleted file mode 100644
index 721ed55..0000000
--- a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package matchers
-
-import (
- "fmt"
-
- "github.com/onsi/gomega/format"
-)
-
-type SucceedMatcher struct {
-}
-
-func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err error) {
- // is purely nil?
- if actual == nil {
- return true, nil
- }
-
- // must be an 'error' type
- if !isError(actual) {
- return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1))
- }
-
- // must be nil (or a pointer to a nil)
- return isNil(actual), nil
-}
-
-func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) {
- return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1))
-}
-
-func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return "Expected failure, but got no error."
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go
deleted file mode 100644
index 119d21e..0000000
--- a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package bipartitegraph
-
-import "errors"
-import "fmt"
-
-import . "github.com/onsi/gomega/matchers/support/goraph/node"
-import . "github.com/onsi/gomega/matchers/support/goraph/edge"
-
-type BipartiteGraph struct {
- Left NodeOrderedSet
- Right NodeOrderedSet
- Edges EdgeSet
-}
-
-func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) {
- left := NodeOrderedSet{}
- for i, _ := range leftValues {
- left = append(left, Node{i})
- }
-
- right := NodeOrderedSet{}
- for j, _ := range rightValues {
- right = append(right, Node{j + len(left)})
- }
-
- edges := EdgeSet{}
- for i, leftValue := range leftValues {
- for j, rightValue := range rightValues {
- neighbours, err := neighbours(leftValue, rightValue)
- if err != nil {
- return nil, errors.New(fmt.Sprintf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error()))
- }
-
- if neighbours {
- edges = append(edges, Edge{left[i], right[j]})
- }
- }
- }
-
- return &BipartiteGraph{left, right, edges}, nil
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go
deleted file mode 100644
index 32529c5..0000000
--- a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package bipartitegraph
-
-import . "github.com/onsi/gomega/matchers/support/goraph/node"
-import . "github.com/onsi/gomega/matchers/support/goraph/edge"
-import "github.com/onsi/gomega/matchers/support/goraph/util"
-
-func (bg *BipartiteGraph) LargestMatching() (matching EdgeSet) {
- paths := bg.maximalDisjointSLAPCollection(matching)
-
- for len(paths) > 0 {
- for _, path := range paths {
- matching = matching.SymmetricDifference(path)
- }
- paths = bg.maximalDisjointSLAPCollection(matching)
- }
-
- return
-}
-
-func (bg *BipartiteGraph) maximalDisjointSLAPCollection(matching EdgeSet) (result []EdgeSet) {
- guideLayers := bg.createSLAPGuideLayers(matching)
- if len(guideLayers) == 0 {
- return
- }
-
- used := make(map[Node]bool)
-
- for _, u := range guideLayers[len(guideLayers)-1] {
- slap, found := bg.findDisjointSLAP(u, matching, guideLayers, used)
- if found {
- for _, edge := range slap {
- used[edge.Node1] = true
- used[edge.Node2] = true
- }
- result = append(result, slap)
- }
- }
-
- return
-}
-
-func (bg *BipartiteGraph) findDisjointSLAP(
- start Node,
- matching EdgeSet,
- guideLayers []NodeOrderedSet,
- used map[Node]bool,
-) ([]Edge, bool) {
- return bg.findDisjointSLAPHelper(start, EdgeSet{}, len(guideLayers)-1, matching, guideLayers, used)
-}
-
-func (bg *BipartiteGraph) findDisjointSLAPHelper(
- currentNode Node,
- currentSLAP EdgeSet,
- currentLevel int,
- matching EdgeSet,
- guideLayers []NodeOrderedSet,
- used map[Node]bool,
-) (EdgeSet, bool) {
- used[currentNode] = true
-
- if currentLevel == 0 {
- return currentSLAP, true
- }
-
- for _, nextNode := range guideLayers[currentLevel-1] {
- if used[nextNode] {
- continue
- }
-
- edge, found := bg.Edges.FindByNodes(currentNode, nextNode)
- if !found {
- continue
- }
-
- if matching.Contains(edge) == util.Odd(currentLevel) {
- continue
- }
-
- currentSLAP = append(currentSLAP, edge)
- slap, found := bg.findDisjointSLAPHelper(nextNode, currentSLAP, currentLevel-1, matching, guideLayers, used)
- if found {
- return slap, true
- }
- currentSLAP = currentSLAP[:len(currentSLAP)-1]
- }
-
- used[currentNode] = false
- return nil, false
-}
-
-func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers []NodeOrderedSet) {
- used := make(map[Node]bool)
- currentLayer := NodeOrderedSet{}
-
- for _, node := range bg.Left {
- if matching.Free(node) {
- used[node] = true
- currentLayer = append(currentLayer, node)
- }
- }
-
- if len(currentLayer) == 0 {
- return []NodeOrderedSet{}
- } else {
- guideLayers = append(guideLayers, currentLayer)
- }
-
- done := false
-
- for !done {
- lastLayer := currentLayer
- currentLayer = NodeOrderedSet{}
-
- if util.Odd(len(guideLayers)) {
- for _, leftNode := range lastLayer {
- for _, rightNode := range bg.Right {
- if used[rightNode] {
- continue
- }
-
- edge, found := bg.Edges.FindByNodes(leftNode, rightNode)
- if !found || matching.Contains(edge) {
- continue
- }
-
- currentLayer = append(currentLayer, rightNode)
- used[rightNode] = true
-
- if matching.Free(rightNode) {
- done = true
- }
- }
- }
- } else {
- for _, rightNode := range lastLayer {
- for _, leftNode := range bg.Left {
- if used[leftNode] {
- continue
- }
-
- edge, found := bg.Edges.FindByNodes(leftNode, rightNode)
- if !found || !matching.Contains(edge) {
- continue
- }
-
- currentLayer = append(currentLayer, leftNode)
- used[leftNode] = true
- }
- }
-
- }
-
- if len(currentLayer) == 0 {
- return []NodeOrderedSet{}
- } else {
- guideLayers = append(guideLayers, currentLayer)
- }
- }
-
- return
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go
deleted file mode 100644
index 4fd15cc..0000000
--- a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package edge
-
-import . "github.com/onsi/gomega/matchers/support/goraph/node"
-
-type Edge struct {
- Node1 Node
- Node2 Node
-}
-
-type EdgeSet []Edge
-
-func (ec EdgeSet) Free(node Node) bool {
- for _, e := range ec {
- if e.Node1 == node || e.Node2 == node {
- return false
- }
- }
-
- return true
-}
-
-func (ec EdgeSet) Contains(edge Edge) bool {
- for _, e := range ec {
- if e == edge {
- return true
- }
- }
-
- return false
-}
-
-func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) {
- for _, e := range ec {
- if (e.Node1 == node1 && e.Node2 == node2) || (e.Node1 == node2 && e.Node2 == node1) {
- return e, true
- }
- }
-
- return Edge{}, false
-}
-
-func (ec EdgeSet) SymmetricDifference(ec2 EdgeSet) EdgeSet {
- edgesToInclude := make(map[Edge]bool)
-
- for _, e := range ec {
- edgesToInclude[e] = true
- }
-
- for _, e := range ec2 {
- edgesToInclude[e] = !edgesToInclude[e]
- }
-
- result := EdgeSet{}
- for e, include := range edgesToInclude {
- if include {
- result = append(result, e)
- }
- }
-
- return result
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go
deleted file mode 100644
index 800c2ea..0000000
--- a/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package node
-
-type Node struct {
- Id int
-}
-
-type NodeOrderedSet []Node
diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go
deleted file mode 100644
index d76a1ee..0000000
--- a/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package util
-
-import "math"
-
-func Odd(n int) bool {
- return math.Mod(float64(n), 2.0) == 1.0
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/type_support.go b/vendor/github.com/onsi/gomega/matchers/type_support.go
deleted file mode 100644
index 04020f0..0000000
--- a/vendor/github.com/onsi/gomega/matchers/type_support.go
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-Gomega matchers
-
-This package implements the Gomega matchers and does not typically need to be imported.
-See the docs for Gomega for documentation on the matchers
-
-http://onsi.github.io/gomega/
-*/
-package matchers
-
-import (
- "fmt"
- "reflect"
-)
-
-type omegaMatcher interface {
- Match(actual interface{}) (success bool, err error)
- FailureMessage(actual interface{}) (message string)
- NegatedFailureMessage(actual interface{}) (message string)
-}
-
-func isBool(a interface{}) bool {
- return reflect.TypeOf(a).Kind() == reflect.Bool
-}
-
-func isNumber(a interface{}) bool {
- if a == nil {
- return false
- }
- kind := reflect.TypeOf(a).Kind()
- return reflect.Int <= kind && kind <= reflect.Float64
-}
-
-func isInteger(a interface{}) bool {
- kind := reflect.TypeOf(a).Kind()
- return reflect.Int <= kind && kind <= reflect.Int64
-}
-
-func isUnsignedInteger(a interface{}) bool {
- kind := reflect.TypeOf(a).Kind()
- return reflect.Uint <= kind && kind <= reflect.Uint64
-}
-
-func isFloat(a interface{}) bool {
- kind := reflect.TypeOf(a).Kind()
- return reflect.Float32 <= kind && kind <= reflect.Float64
-}
-
-func toInteger(a interface{}) int64 {
- if isInteger(a) {
- return reflect.ValueOf(a).Int()
- } else if isUnsignedInteger(a) {
- return int64(reflect.ValueOf(a).Uint())
- } else if isFloat(a) {
- return int64(reflect.ValueOf(a).Float())
- } else {
- panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a))
- }
-}
-
-func toUnsignedInteger(a interface{}) uint64 {
- if isInteger(a) {
- return uint64(reflect.ValueOf(a).Int())
- } else if isUnsignedInteger(a) {
- return reflect.ValueOf(a).Uint()
- } else if isFloat(a) {
- return uint64(reflect.ValueOf(a).Float())
- } else {
- panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a))
- }
-}
-
-func toFloat(a interface{}) float64 {
- if isInteger(a) {
- return float64(reflect.ValueOf(a).Int())
- } else if isUnsignedInteger(a) {
- return float64(reflect.ValueOf(a).Uint())
- } else if isFloat(a) {
- return reflect.ValueOf(a).Float()
- } else {
- panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a))
- }
-}
-
-func isError(a interface{}) bool {
- _, ok := a.(error)
- return ok
-}
-
-func isChan(a interface{}) bool {
- if isNil(a) {
- return false
- }
- return reflect.TypeOf(a).Kind() == reflect.Chan
-}
-
-func isMap(a interface{}) bool {
- if a == nil {
- return false
- }
- return reflect.TypeOf(a).Kind() == reflect.Map
-}
-
-func isArrayOrSlice(a interface{}) bool {
- if a == nil {
- return false
- }
- switch reflect.TypeOf(a).Kind() {
- case reflect.Array, reflect.Slice:
- return true
- default:
- return false
- }
-}
-
-func isString(a interface{}) bool {
- if a == nil {
- return false
- }
- return reflect.TypeOf(a).Kind() == reflect.String
-}
-
-func toString(a interface{}) (string, bool) {
- aString, isString := a.(string)
- if isString {
- return aString, true
- }
-
- aBytes, isBytes := a.([]byte)
- if isBytes {
- return string(aBytes), true
- }
-
- aStringer, isStringer := a.(fmt.Stringer)
- if isStringer {
- return aStringer.String(), true
- }
-
- return "", false
-}
-
-func lengthOf(a interface{}) (int, bool) {
- if a == nil {
- return 0, false
- }
- switch reflect.TypeOf(a).Kind() {
- case reflect.Map, reflect.Array, reflect.String, reflect.Chan, reflect.Slice:
- return reflect.ValueOf(a).Len(), true
- default:
- return 0, false
- }
-}
-func capOf(a interface{}) (int, bool) {
- if a == nil {
- return 0, false
- }
- switch reflect.TypeOf(a).Kind() {
- case reflect.Array, reflect.Chan, reflect.Slice:
- return reflect.ValueOf(a).Cap(), true
- default:
- return 0, false
- }
-}
-
-func isNil(a interface{}) bool {
- if a == nil {
- return true
- }
-
- switch reflect.TypeOf(a).Kind() {
- case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return reflect.ValueOf(a).IsNil()
- }
-
- return false
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/with_transform.go b/vendor/github.com/onsi/gomega/matchers/with_transform.go
deleted file mode 100644
index 8e58d8a..0000000
--- a/vendor/github.com/onsi/gomega/matchers/with_transform.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package matchers
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/internal/oraclematcher"
- "github.com/onsi/gomega/types"
-)
-
-type WithTransformMatcher struct {
- // input
- Transform interface{} // must be a function of one parameter that returns one value
- Matcher types.GomegaMatcher
-
- // cached value
- transformArgType reflect.Type
-
- // state
- transformedValue interface{}
-}
-
-func NewWithTransformMatcher(transform interface{}, matcher types.GomegaMatcher) *WithTransformMatcher {
- if transform == nil {
- panic("transform function cannot be nil")
- }
- txType := reflect.TypeOf(transform)
- if txType.NumIn() != 1 {
- panic("transform function must have 1 argument")
- }
- if txType.NumOut() != 1 {
- panic("transform function must have 1 return value")
- }
-
- return &WithTransformMatcher{
- Transform: transform,
- Matcher: matcher,
- transformArgType: reflect.TypeOf(transform).In(0),
- }
-}
-
-func (m *WithTransformMatcher) Match(actual interface{}) (bool, error) {
- // return error if actual's type is incompatible with Transform function's argument type
- actualType := reflect.TypeOf(actual)
- if !actualType.AssignableTo(m.transformArgType) {
- return false, fmt.Errorf("Transform function expects '%s' but we have '%s'", m.transformArgType, actualType)
- }
-
- // call the Transform function with `actual`
- fn := reflect.ValueOf(m.Transform)
- result := fn.Call([]reflect.Value{reflect.ValueOf(actual)})
- m.transformedValue = result[0].Interface() // expect exactly one value
-
- return m.Matcher.Match(m.transformedValue)
-}
-
-func (m *WithTransformMatcher) FailureMessage(_ interface{}) (message string) {
- return m.Matcher.FailureMessage(m.transformedValue)
-}
-
-func (m *WithTransformMatcher) NegatedFailureMessage(_ interface{}) (message string) {
- return m.Matcher.NegatedFailureMessage(m.transformedValue)
-}
-
-func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ interface{}) bool {
- // TODO: Maybe this should always just return true? (Only an issue for non-deterministic transformers.)
- //
- // Querying the next matcher is fine if the transformer always will return the same value.
- // But if the transformer is non-deterministic and returns a different value each time, then there
- // is no point in querying the next matcher, since it can only comment on the last transformed value.
- return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, m.transformedValue)
-}