update testing related dependencies
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
5
vendor/github.com/onsi/gomega/.travis.yml
generated
vendored
5
vendor/github.com/onsi/gomega/.travis.yml
generated
vendored
@@ -1,9 +1,8 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.10.x
|
||||
- 1.11.x
|
||||
- 1.12.x
|
||||
- 1.13.x
|
||||
- 1.14.x
|
||||
- gotip
|
||||
|
||||
env:
|
||||
|
36
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
36
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
@@ -1,3 +1,39 @@
|
||||
## 1.10.1
|
||||
|
||||
### Fixes
|
||||
- Update dependencies (#389) [9f5eecd]
|
||||
|
||||
## 1.10.0
|
||||
|
||||
### Features
|
||||
- Add HaveHTTPStatusMatcher (#378) [f335c94]
|
||||
- Changed matcher for content-type in VerifyJSONRepresenting (#377) [6024f5b]
|
||||
- Make ghttp usable with x-unit style tests (#376) [c0be499]
|
||||
- Implement PanicWith matcher (#381) [f8032b4]
|
||||
|
||||
## 1.9.0
|
||||
|
||||
### Features
|
||||
- Add ContainElements matcher (#370) [2f57380]
|
||||
- Output missing and extra elements in ConsistOf failure message [a31eda7]
|
||||
- Document method LargestMatching [7c5a280]
|
||||
|
||||
## 1.8.1
|
||||
|
||||
### Fixes
|
||||
- Fix unexpected MatchError() behaviour (#375) [8ae7b2f]
|
||||
|
||||
## 1.8.0
|
||||
|
||||
### Features
|
||||
- Allow optional description to be lazily evaluated function (#364) [bf64010]
|
||||
- Support wrapped errors (#359) [0a981cb]
|
||||
|
||||
## 1.7.1
|
||||
|
||||
### Fixes
|
||||
- Bump go-yaml version to cover fixed ddos heuristic (#362) [95e431e]
|
||||
|
||||
## 1.7.0
|
||||
|
||||
### Features
|
||||
|
16
vendor/github.com/onsi/gomega/go.mod
generated
vendored
16
vendor/github.com/onsi/gomega/go.mod
generated
vendored
@@ -1,15 +1,9 @@
|
||||
module github.com/onsi/gomega
|
||||
|
||||
require (
|
||||
github.com/fsnotify/fsnotify v1.4.7 // indirect
|
||||
github.com/golang/protobuf v1.2.0
|
||||
github.com/hpcloud/tail v1.0.0 // indirect
|
||||
github.com/onsi/ginkgo v1.6.0
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e // indirect
|
||||
golang.org/x/text v0.3.0 // indirect
|
||||
gopkg.in/fsnotify.v1 v1.4.7 // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.1
|
||||
github.com/golang/protobuf v1.4.2
|
||||
github.com/onsi/ginkgo v1.12.1
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
)
|
||||
|
40
vendor/github.com/onsi/gomega/go.sum
generated
vendored
40
vendor/github.com/onsi/gomega/go.sum
generated
vendored
@@ -2,23 +2,59 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e h1:N7DeIrjYszNmSW409R3frPPwglRwMkXSBzwVbkOjLLA=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
50
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
50
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
@@ -24,7 +24,7 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
const GOMEGA_VERSION = "1.7.0"
|
||||
const GOMEGA_VERSION = "1.10.1"
|
||||
|
||||
const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil.
|
||||
If you're using Ginkgo then you probably forgot to put your assertion in an It().
|
||||
@@ -252,7 +252,7 @@ func Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion {
|
||||
return ConsistentlyWithOffset(0, actual, intervals...)
|
||||
}
|
||||
|
||||
// ConsistentlyWithOffset operates like Consistnetly but takes an additional
|
||||
// ConsistentlyWithOffset operates like Consistently but takes an additional
|
||||
// initial argument to indicate an offset in the call stack. This is useful when building helper
|
||||
// functions that contain matchers. To learn more, read about `ExpectWithOffset`.
|
||||
func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion {
|
||||
@@ -293,16 +293,18 @@ func SetDefaultConsistentlyPollingInterval(t time.Duration) {
|
||||
// AsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against
|
||||
// the matcher passed to the Should and ShouldNot methods.
|
||||
//
|
||||
// Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to
|
||||
// fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more
|
||||
// descriptive.
|
||||
// Both Should and ShouldNot take a variadic optionalDescription argument.
|
||||
// This argument allows you to make your failure messages more descriptive.
|
||||
// If a single argument of type `func() string` is passed, this function will be lazily evaluated if a failure occurs
|
||||
// and the returned string is used to annotate the failure message.
|
||||
// Otherwise, this argument is passed on to fmt.Sprintf() and then used to annotate the failure message.
|
||||
//
|
||||
// Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.")
|
||||
// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.")
|
||||
// Consistently(myChannel).ShouldNot(Receive(), func() string { return "Nothing should have come down the pipe." })
|
||||
type AsyncAssertion interface {
|
||||
Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool
|
||||
ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool
|
||||
@@ -317,8 +319,11 @@ type GomegaAsyncAssertion = AsyncAssertion
|
||||
// Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect
|
||||
// though this is not enforced.
|
||||
//
|
||||
// All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf()
|
||||
// and is used to annotate failure messages.
|
||||
// All methods take a variadic optionalDescription argument.
|
||||
// This argument allows you to make your failure messages more descriptive.
|
||||
// If a single argument of type `func() string` is passed, this function will be lazily evaluated if a failure occurs
|
||||
// and the returned string is used to annotate the failure message.
|
||||
// Otherwise, this argument is passed on to fmt.Sprintf() and then used to annotate the failure message.
|
||||
//
|
||||
// All methods return a bool that is true if the assertion passed and false if it failed.
|
||||
//
|
||||
@@ -427,3 +432,32 @@ func toDuration(input interface{}) time.Duration {
|
||||
|
||||
panic(fmt.Sprintf("%v is not a valid interval. Must be time.Duration, parsable duration string or a number.", input))
|
||||
}
|
||||
|
||||
// Gomega describes the essential Gomega DSL. This interface allows libraries
|
||||
// to abstract between the standard package-level function implementations
|
||||
// and alternatives like *WithT.
|
||||
type Gomega interface {
|
||||
Expect(actual interface{}, extra ...interface{}) Assertion
|
||||
Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion
|
||||
Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion
|
||||
}
|
||||
|
||||
type globalFailHandlerGomega struct{}
|
||||
|
||||
// DefaultGomega supplies the standard package-level implementation
|
||||
var Default Gomega = globalFailHandlerGomega{}
|
||||
|
||||
// Expect is used to make assertions. See documentation for Expect.
|
||||
func (globalFailHandlerGomega) Expect(actual interface{}, extra ...interface{}) Assertion {
|
||||
return Expect(actual, extra...)
|
||||
}
|
||||
|
||||
// Eventually is used to make asynchronous assertions. See documentation for Eventually.
|
||||
func (globalFailHandlerGomega) Eventually(actual interface{}, extra ...interface{}) AsyncAssertion {
|
||||
return Eventually(actual, extra...)
|
||||
}
|
||||
|
||||
// Consistently is used to make asynchronous assertions. See documentation for Consistently.
|
||||
func (globalFailHandlerGomega) Consistently(actual interface{}, extra ...interface{}) AsyncAssertion {
|
||||
return Consistently(actual, extra...)
|
||||
}
|
||||
|
10
vendor/github.com/onsi/gomega/internal/assertion/assertion.go
generated
vendored
10
vendor/github.com/onsi/gomega/internal/assertion/assertion.go
generated
vendored
@@ -52,16 +52,19 @@ func (assertion *Assertion) buildDescription(optionalDescription ...interface{})
|
||||
switch len(optionalDescription) {
|
||||
case 0:
|
||||
return ""
|
||||
default:
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
case 1:
|
||||
if describe, ok := optionalDescription[0].(func() string); ok {
|
||||
return describe() + "\n"
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
}
|
||||
|
||||
func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool {
|
||||
matches, err := matcher.Match(assertion.actualInput)
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.TWithHelper.Helper()
|
||||
if err != nil {
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.Fail(description+err.Error(), 2+assertion.offset)
|
||||
return false
|
||||
}
|
||||
@@ -72,6 +75,7 @@ func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool
|
||||
} else {
|
||||
message = matcher.NegatedFailureMessage(assertion.actualInput)
|
||||
}
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.Fail(description+message, 2+assertion.offset)
|
||||
return false
|
||||
}
|
||||
|
10
vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
generated
vendored
10
vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
generated
vendored
@@ -60,9 +60,12 @@ func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interfa
|
||||
switch len(optionalDescription) {
|
||||
case 0:
|
||||
return ""
|
||||
default:
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
case 1:
|
||||
if describe, ok := optionalDescription[0].(func() string); ok {
|
||||
return describe() + "\n"
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n"
|
||||
}
|
||||
|
||||
func (assertion *AsyncAssertion) actualInputIsAFunction() bool {
|
||||
@@ -103,8 +106,6 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
|
||||
timer := time.Now()
|
||||
timeout := time.After(assertion.timeoutInterval)
|
||||
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
|
||||
var matches bool
|
||||
var err error
|
||||
mayChange := true
|
||||
@@ -129,6 +130,7 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
|
||||
}
|
||||
}
|
||||
assertion.failWrapper.TWithHelper.Helper()
|
||||
description := assertion.buildDescription(optionalDescription...)
|
||||
assertion.failWrapper.Fail(fmt.Sprintf("%s after %.3fs.\n%s%s%s", preamble, time.Since(timer).Seconds(), description, message, errMsg), 3+assertion.offset)
|
||||
}
|
||||
|
||||
|
33
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
33
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
@@ -306,6 +306,20 @@ func ConsistOf(elements ...interface{}) types.GomegaMatcher {
|
||||
}
|
||||
}
|
||||
|
||||
//ContainElements succeeds if actual contains the passed in elements. The ordering of the elements does not matter.
|
||||
//By default ContainElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples:
|
||||
//
|
||||
// Expect([]string{"Foo", "FooBar"}).Should(ContainElements("FooBar"))
|
||||
// Expect([]string{"Foo", "FooBar"}).Should(ContainElements(ContainSubstring("Bar"), "Foo"))
|
||||
//
|
||||
//Actual must be an array, slice or map.
|
||||
//For maps, ContainElements searches through the map's values.
|
||||
func ContainElements(elements ...interface{}) types.GomegaMatcher {
|
||||
return &matchers.ContainElementsMatcher{
|
||||
Elements: elements,
|
||||
}
|
||||
}
|
||||
|
||||
//HaveKey succeeds if actual is a map with the passed in key.
|
||||
//By default HaveKey uses Equal() to perform the match, however a
|
||||
//matcher can be passed in instead:
|
||||
@@ -376,6 +390,16 @@ func Panic() types.GomegaMatcher {
|
||||
return &matchers.PanicMatcher{}
|
||||
}
|
||||
|
||||
//PanicWith succeeds if actual is a function that, when invoked, panics with a specific value.
|
||||
//Actual must be a function that takes no arguments and returns no results.
|
||||
//
|
||||
//By default PanicWith uses Equal() to perform the match, however a
|
||||
//matcher can be passed in instead:
|
||||
// Expect(fn).Should(PanicWith(MatchRegexp(`.+Foo$`)))
|
||||
func PanicWith(expected interface{}) types.GomegaMatcher {
|
||||
return &matchers.PanicMatcher{Expected: expected}
|
||||
}
|
||||
|
||||
//BeAnExistingFile succeeds if a file exists.
|
||||
//Actual must be a string representing the abs path to the file being checked.
|
||||
func BeAnExistingFile() types.GomegaMatcher {
|
||||
@@ -394,6 +418,15 @@ func BeADirectory() types.GomegaMatcher {
|
||||
return &matchers.BeADirectoryMatcher{}
|
||||
}
|
||||
|
||||
//HaveHTTPStatus succeeds if the Status or StatusCode field of an HTTP response matches.
|
||||
//Actual must be either a *http.Response or *httptest.ResponseRecorder.
|
||||
//Expected must be either an int or a string.
|
||||
// Expect(resp).Should(HaveHTTPStatus(http.StatusOK)) // asserts that resp.StatusCode == 200
|
||||
// Expect(resp).Should(HaveHTTPStatus("404 Not Found")) // asserts that resp.Status == "404 Not Found"
|
||||
func HaveHTTPStatus(expected interface{}) types.GomegaMatcher {
|
||||
return &matchers.HaveHTTPStatusMatcher{Expected: expected}
|
||||
}
|
||||
|
||||
//And succeeds only if all of the given matchers succeed.
|
||||
//The matchers are tried in order, and will fail-fast if one doesn't succeed.
|
||||
// Expect("hi").To(And(HaveLen(2), Equal("hi"))
|
||||
|
99
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
99
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
@@ -11,7 +11,9 @@ import (
|
||||
)
|
||||
|
||||
type ConsistOfMatcher struct {
|
||||
Elements []interface{}
|
||||
Elements []interface{}
|
||||
missingElements []interface{}
|
||||
extraElements []interface{}
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
@@ -19,44 +21,63 @@ func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err er
|
||||
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
|
||||
}
|
||||
matchers := matchers(matcher.Elements)
|
||||
values := valuesOf(actual)
|
||||
|
||||
bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(values, matchers, neighbours)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return len(bipartiteGraph.LargestMatching()) == len(values), nil
|
||||
edges := bipartiteGraph.LargestMatching()
|
||||
if len(edges) == len(values) && len(edges) == len(matchers) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
var missingMatchers []interface{}
|
||||
matcher.extraElements, missingMatchers = bipartiteGraph.FreeLeftRight(edges)
|
||||
matcher.missingElements = equalMatchersToElements(missingMatchers)
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} {
|
||||
func neighbours(value, matcher interface{}) (bool, error) {
|
||||
match, err := matcher.(omegaMatcher).Match(value)
|
||||
return match && err == nil, nil
|
||||
}
|
||||
|
||||
func equalMatchersToElements(matchers []interface{}) (elements []interface{}) {
|
||||
for _, matcher := range matchers {
|
||||
equalMatcher, ok := matcher.(*EqualMatcher)
|
||||
if ok {
|
||||
matcher = equalMatcher.Expected
|
||||
}
|
||||
elements = append(elements, matcher)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func matchers(expectedElems []interface{}) (matchers []interface{}) {
|
||||
elems := expectedElems
|
||||
if len(expectedElems) == 1 && isArrayOrSlice(expectedElems[0]) {
|
||||
elems = []interface{}{}
|
||||
value := reflect.ValueOf(expectedElems[0])
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
elems = append(elems, value.Index(i).Interface())
|
||||
}
|
||||
}
|
||||
|
||||
for _, e := range elems {
|
||||
matcher, isMatcher := e.(omegaMatcher)
|
||||
if !isMatcher {
|
||||
matcher = &EqualMatcher{Expected: e}
|
||||
}
|
||||
matchers = append(matchers, matcher)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func valuesOf(actual interface{}) []interface{} {
|
||||
value := reflect.ValueOf(actual)
|
||||
values := []interface{}{}
|
||||
if isMap(actual) {
|
||||
@@ -74,7 +95,21 @@ func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} {
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to consist of", matcher.Elements)
|
||||
message = format.Message(actual, "to consist of", matcher.Elements)
|
||||
message = appendMissingElements(message, matcher.missingElements)
|
||||
if len(matcher.extraElements) > 0 {
|
||||
message = fmt.Sprintf("%s\nthe extra elements were\n%s", message,
|
||||
format.Object(matcher.extraElements, 1))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func appendMissingElements(message string, missingElements []interface{}) string {
|
||||
if len(missingElements) == 0 {
|
||||
return message
|
||||
}
|
||||
return fmt.Sprintf("%s\nthe missing elements were\n%s", message,
|
||||
format.Object(missingElements, 1))
|
||||
}
|
||||
|
||||
func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
|
44
vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go
generated
vendored
Normal file
44
vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
"github.com/onsi/gomega/matchers/support/goraph/bipartitegraph"
|
||||
)
|
||||
|
||||
type ContainElementsMatcher struct {
|
||||
Elements []interface{}
|
||||
missingElements []interface{}
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
if !isArrayOrSlice(actual) && !isMap(actual) {
|
||||
return false, fmt.Errorf("ContainElements matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1))
|
||||
}
|
||||
|
||||
matchers := matchers(matcher.Elements)
|
||||
bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(valuesOf(actual), matchers, neighbours)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
edges := bipartiteGraph.LargestMatching()
|
||||
if len(edges) == len(matchers) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
_, missingMatchers := bipartiteGraph.FreeLeftRight(edges)
|
||||
matcher.missingElements = equalMatchersToElements(missingMatchers)
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
message = format.Message(actual, "to contain elements", matcher.Elements)
|
||||
return appendMissingElements(message, matcher.missingElements)
|
||||
}
|
||||
|
||||
func (matcher *ContainElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to contain elements", matcher.Elements)
|
||||
}
|
42
vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go
generated
vendored
Normal file
42
vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
)
|
||||
|
||||
type HaveHTTPStatusMatcher struct {
|
||||
Expected interface{}
|
||||
}
|
||||
|
||||
func (matcher *HaveHTTPStatusMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
var resp *http.Response
|
||||
switch a := actual.(type) {
|
||||
case *http.Response:
|
||||
resp = a
|
||||
case *httptest.ResponseRecorder:
|
||||
resp = a.Result()
|
||||
default:
|
||||
return false, fmt.Errorf("HaveHTTPStatus matcher expects *http.Response or *httptest.ResponseRecorder. Got:\n%s", format.Object(actual, 1))
|
||||
}
|
||||
|
||||
switch e := matcher.Expected.(type) {
|
||||
case int:
|
||||
return resp.StatusCode == e, nil
|
||||
case string:
|
||||
return resp.Status == e, nil
|
||||
}
|
||||
|
||||
return false, fmt.Errorf("HaveHTTPStatus matcher must be passed an int or a string. Got:\n%s", format.Object(matcher.Expected, 1))
|
||||
}
|
||||
|
||||
func (matcher *HaveHTTPStatusMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to have HTTP status", matcher.Expected)
|
||||
}
|
||||
|
||||
func (matcher *HaveHTTPStatusMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to have HTTP status", matcher.Expected)
|
||||
}
|
18
vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
generated
vendored
18
vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
generated
vendored
@@ -5,6 +5,7 @@ import (
|
||||
"reflect"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
type MatchErrorMatcher struct {
|
||||
@@ -21,25 +22,28 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e
|
||||
}
|
||||
|
||||
actualErr := actual.(error)
|
||||
expected := matcher.Expected
|
||||
|
||||
if isError(matcher.Expected) {
|
||||
return reflect.DeepEqual(actualErr, matcher.Expected), nil
|
||||
if isError(expected) {
|
||||
return reflect.DeepEqual(actualErr, expected) || xerrors.Is(actualErr, expected.(error)), nil
|
||||
}
|
||||
|
||||
if isString(matcher.Expected) {
|
||||
return actualErr.Error() == matcher.Expected, nil
|
||||
if isString(expected) {
|
||||
return actualErr.Error() == expected, nil
|
||||
}
|
||||
|
||||
var subMatcher omegaMatcher
|
||||
var hasSubMatcher bool
|
||||
if matcher.Expected != nil {
|
||||
subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher)
|
||||
if expected != nil {
|
||||
subMatcher, hasSubMatcher = (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))
|
||||
return false, fmt.Errorf(
|
||||
"MatchError must be passed an error, a string, or a Matcher that can match on strings. Got:\n%s",
|
||||
format.Object(expected, 1))
|
||||
}
|
||||
|
||||
func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
|
76
vendor/github.com/onsi/gomega/matchers/panic_matcher.go
generated
vendored
76
vendor/github.com/onsi/gomega/matchers/panic_matcher.go
generated
vendored
@@ -8,7 +8,8 @@ import (
|
||||
)
|
||||
|
||||
type PanicMatcher struct {
|
||||
object interface{}
|
||||
Expected interface{}
|
||||
object interface{}
|
||||
}
|
||||
|
||||
func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
@@ -28,7 +29,21 @@ func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error)
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
matcher.object = e
|
||||
success = true
|
||||
|
||||
if matcher.Expected == nil {
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
valueMatcher, valueIsMatcher := matcher.Expected.(omegaMatcher)
|
||||
if !valueIsMatcher {
|
||||
valueMatcher = &EqualMatcher{Expected: matcher.Expected}
|
||||
}
|
||||
|
||||
success, err = valueMatcher.Match(e)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("PanicMatcher's value matcher failed with:\n%s%s", format.Indent, err.Error())
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -38,9 +53,62 @@ func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error)
|
||||
}
|
||||
|
||||
func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to panic")
|
||||
if matcher.Expected == nil {
|
||||
// We wanted any panic to occur, but none did.
|
||||
return format.Message(actual, "to panic")
|
||||
}
|
||||
|
||||
if matcher.object == nil {
|
||||
// We wanted a panic with a specific value to occur, but none did.
|
||||
switch matcher.Expected.(type) {
|
||||
case omegaMatcher:
|
||||
return format.Message(actual, "to panic with a value matching", matcher.Expected)
|
||||
default:
|
||||
return format.Message(actual, "to panic with", matcher.Expected)
|
||||
}
|
||||
}
|
||||
|
||||
// We got a panic, but the value isn't what we expected.
|
||||
switch matcher.Expected.(type) {
|
||||
case omegaMatcher:
|
||||
return format.Message(
|
||||
actual,
|
||||
fmt.Sprintf(
|
||||
"to panic with a value matching\n%s\nbut panicked with\n%s",
|
||||
format.Object(matcher.Expected, 1),
|
||||
format.Object(matcher.object, 1),
|
||||
),
|
||||
)
|
||||
default:
|
||||
return format.Message(
|
||||
actual,
|
||||
fmt.Sprintf(
|
||||
"to panic with\n%s\nbut panicked with\n%s",
|
||||
format.Object(matcher.Expected, 1),
|
||||
format.Object(matcher.object, 1),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
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)))
|
||||
if matcher.Expected == nil {
|
||||
// We didn't want any panic to occur, but one did.
|
||||
return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1)))
|
||||
}
|
||||
|
||||
// We wanted a to ensure a panic with a specific value did not occur, but it did.
|
||||
switch matcher.Expected.(type) {
|
||||
case omegaMatcher:
|
||||
return format.Message(
|
||||
actual,
|
||||
fmt.Sprintf(
|
||||
"not to panic with a value matching\n%s\nbut panicked with\n%s",
|
||||
format.Object(matcher.Expected, 1),
|
||||
format.Object(matcher.object, 1),
|
||||
),
|
||||
)
|
||||
default:
|
||||
return format.Message(actual, "not to panic with", matcher.Expected)
|
||||
}
|
||||
}
|
||||
|
26
vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go
generated
vendored
26
vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go
generated
vendored
@@ -13,13 +13,13 @@ type BipartiteGraph struct {
|
||||
|
||||
func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) {
|
||||
left := NodeOrderedSet{}
|
||||
for i := range leftValues {
|
||||
left = append(left, Node{Id: i})
|
||||
for i, v := range leftValues {
|
||||
left = append(left, Node{ID: i, Value: v})
|
||||
}
|
||||
|
||||
right := NodeOrderedSet{}
|
||||
for j := range rightValues {
|
||||
right = append(right, Node{Id: j + len(left)})
|
||||
for j, v := range rightValues {
|
||||
right = append(right, Node{ID: j + len(left), Value: v})
|
||||
}
|
||||
|
||||
edges := EdgeSet{}
|
||||
@@ -31,10 +31,26 @@ func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(in
|
||||
}
|
||||
|
||||
if neighbours {
|
||||
edges = append(edges, Edge{Node1: left[i], Node2: right[j]})
|
||||
edges = append(edges, Edge{Node1: left[i].ID, Node2: right[j].ID})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &BipartiteGraph{left, right, edges}, nil
|
||||
}
|
||||
|
||||
// FreeLeftRight returns left node values and right node values
|
||||
// of the BipartiteGraph's nodes which are not part of the given edges.
|
||||
func (bg *BipartiteGraph) FreeLeftRight(edges EdgeSet) (leftValues, rightValues []interface{}) {
|
||||
for _, node := range bg.Left {
|
||||
if edges.Free(node) {
|
||||
leftValues = append(leftValues, node.Value)
|
||||
}
|
||||
}
|
||||
for _, node := range bg.Right {
|
||||
if edges.Free(node) {
|
||||
rightValues = append(rightValues, node.Value)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@@ -1,9 +1,14 @@
|
||||
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"
|
||||
import (
|
||||
. "github.com/onsi/gomega/matchers/support/goraph/edge"
|
||||
. "github.com/onsi/gomega/matchers/support/goraph/node"
|
||||
"github.com/onsi/gomega/matchers/support/goraph/util"
|
||||
)
|
||||
|
||||
// LargestMatching implements the Hopcroft–Karp algorithm taking as input a bipartite graph
|
||||
// and outputting a maximum cardinality matching, i.e. a set of as many edges as possible
|
||||
// with the property that no two edges share an endpoint.
|
||||
func (bg *BipartiteGraph) LargestMatching() (matching EdgeSet) {
|
||||
paths := bg.maximalDisjointSLAPCollection(matching)
|
||||
|
||||
@@ -23,7 +28,7 @@ func (bg *BipartiteGraph) maximalDisjointSLAPCollection(matching EdgeSet) (resul
|
||||
return
|
||||
}
|
||||
|
||||
used := make(map[Node]bool)
|
||||
used := make(map[int]bool)
|
||||
|
||||
for _, u := range guideLayers[len(guideLayers)-1] {
|
||||
slap, found := bg.findDisjointSLAP(u, matching, guideLayers, used)
|
||||
@@ -43,7 +48,7 @@ func (bg *BipartiteGraph) findDisjointSLAP(
|
||||
start Node,
|
||||
matching EdgeSet,
|
||||
guideLayers []NodeOrderedSet,
|
||||
used map[Node]bool,
|
||||
used map[int]bool,
|
||||
) ([]Edge, bool) {
|
||||
return bg.findDisjointSLAPHelper(start, EdgeSet{}, len(guideLayers)-1, matching, guideLayers, used)
|
||||
}
|
||||
@@ -54,16 +59,16 @@ func (bg *BipartiteGraph) findDisjointSLAPHelper(
|
||||
currentLevel int,
|
||||
matching EdgeSet,
|
||||
guideLayers []NodeOrderedSet,
|
||||
used map[Node]bool,
|
||||
used map[int]bool,
|
||||
) (EdgeSet, bool) {
|
||||
used[currentNode] = true
|
||||
used[currentNode.ID] = true
|
||||
|
||||
if currentLevel == 0 {
|
||||
return currentSLAP, true
|
||||
}
|
||||
|
||||
for _, nextNode := range guideLayers[currentLevel-1] {
|
||||
if used[nextNode] {
|
||||
if used[nextNode.ID] {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -84,17 +89,17 @@ func (bg *BipartiteGraph) findDisjointSLAPHelper(
|
||||
currentSLAP = currentSLAP[:len(currentSLAP)-1]
|
||||
}
|
||||
|
||||
used[currentNode] = false
|
||||
used[currentNode.ID] = false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers []NodeOrderedSet) {
|
||||
used := make(map[Node]bool)
|
||||
used := make(map[int]bool)
|
||||
currentLayer := NodeOrderedSet{}
|
||||
|
||||
for _, node := range bg.Left {
|
||||
if matching.Free(node) {
|
||||
used[node] = true
|
||||
used[node.ID] = true
|
||||
currentLayer = append(currentLayer, node)
|
||||
}
|
||||
}
|
||||
@@ -113,7 +118,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
if util.Odd(len(guideLayers)) {
|
||||
for _, leftNode := range lastLayer {
|
||||
for _, rightNode := range bg.Right {
|
||||
if used[rightNode] {
|
||||
if used[rightNode.ID] {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -123,7 +128,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
}
|
||||
|
||||
currentLayer = append(currentLayer, rightNode)
|
||||
used[rightNode] = true
|
||||
used[rightNode.ID] = true
|
||||
|
||||
if matching.Free(rightNode) {
|
||||
done = true
|
||||
@@ -133,7 +138,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
} else {
|
||||
for _, rightNode := range lastLayer {
|
||||
for _, leftNode := range bg.Left {
|
||||
if used[leftNode] {
|
||||
if used[leftNode.ID] {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -143,7 +148,7 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [
|
||||
}
|
||||
|
||||
currentLayer = append(currentLayer, leftNode)
|
||||
used[leftNode] = true
|
||||
used[leftNode.ID] = true
|
||||
}
|
||||
}
|
||||
|
||||
|
8
vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go
generated
vendored
8
vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go
generated
vendored
@@ -3,15 +3,15 @@ package edge
|
||||
import . "github.com/onsi/gomega/matchers/support/goraph/node"
|
||||
|
||||
type Edge struct {
|
||||
Node1 Node
|
||||
Node2 Node
|
||||
Node1 int
|
||||
Node2 int
|
||||
}
|
||||
|
||||
type EdgeSet []Edge
|
||||
|
||||
func (ec EdgeSet) Free(node Node) bool {
|
||||
for _, e := range ec {
|
||||
if e.Node1 == node || e.Node2 == node {
|
||||
if e.Node1 == node.ID || e.Node2 == node.ID {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ func (ec EdgeSet) Contains(edge Edge) bool {
|
||||
|
||||
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) {
|
||||
if (e.Node1 == node1.ID && e.Node2 == node2.ID) || (e.Node1 == node2.ID && e.Node2 == node1.ID) {
|
||||
return e, true
|
||||
}
|
||||
}
|
||||
|
3
vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go
generated
vendored
3
vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go
generated
vendored
@@ -1,7 +1,8 @@
|
||||
package node
|
||||
|
||||
type Node struct {
|
||||
Id int
|
||||
ID int
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
type NodeOrderedSet []Node
|
||||
|
Reference in New Issue
Block a user