Add e2e tests
This commit is contained in:
parent
99a355f25d
commit
601fb7dacf
1163 changed files with 289217 additions and 14195 deletions
62
vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go
generated
vendored
Normal file
62
vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
package matchers_test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
. "github.com/onsi/gomega/matchers"
|
||||
)
|
||||
|
||||
func Erroring() error {
|
||||
return errors.New("bam")
|
||||
}
|
||||
|
||||
func NotErroring() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AnyType struct{}
|
||||
|
||||
func Invalid() *AnyType {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ = Describe("Succeed", func() {
|
||||
It("should succeed if the function succeeds", func() {
|
||||
Ω(NotErroring()).Should(Succeed())
|
||||
})
|
||||
|
||||
It("should succeed (in the negated) if the function errored", func() {
|
||||
Ω(Erroring()).ShouldNot(Succeed())
|
||||
})
|
||||
|
||||
It("should not if passed a non-error", func() {
|
||||
success, err := (&SucceedMatcher{}).Match(Invalid())
|
||||
Ω(success).Should(BeFalse())
|
||||
Ω(err).Should(MatchError("Expected an error-type. Got:\n <*matchers_test.AnyType | 0x0>: nil"))
|
||||
})
|
||||
|
||||
It("doesn't support non-error type", func() {
|
||||
success, err := (&SucceedMatcher{}).Match(AnyType{})
|
||||
Ω(success).Should(BeFalse())
|
||||
Ω(err).Should(MatchError("Expected an error-type. Got:\n <matchers_test.AnyType>: {}"))
|
||||
})
|
||||
|
||||
It("doesn't support non-error pointer type", func() {
|
||||
success, err := (&SucceedMatcher{}).Match(&AnyType{})
|
||||
Ω(success).Should(BeFalse())
|
||||
Ω(err).Should(MatchError(MatchRegexp(`Expected an error-type. Got:\n <*matchers_test.AnyType | 0x[[:xdigit:]]+>: {}`)))
|
||||
})
|
||||
|
||||
It("should not succeed with pointer types that conform to error interface", func() {
|
||||
err := &CustomErr{"ohai"}
|
||||
Ω(err).ShouldNot(Succeed())
|
||||
})
|
||||
|
||||
It("should succeed with nil pointers to types that conform to error interface", func() {
|
||||
var err *CustomErr = nil
|
||||
Ω(err).Should(Succeed())
|
||||
})
|
||||
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue