summaryrefslogtreecommitdiff
path: root/vendor/github.com/onsi/gomega/internal/gomega.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-08-06 14:22:43 +0000
committerGitHub <noreply@github.com>2021-08-06 14:22:43 +0000
commit9853b147199b270271f2fa68fdef68bc4027ed33 (patch)
treece71c03c58e0d78e7f02eb068db12b7d5d1be9b6 /vendor/github.com/onsi/gomega/internal/gomega.go
parent840981773325499c241d518ffbda06762cfdc759 (diff)
parent79e4baf4ca5d61a4e9c997f9ec025e46e45e5d9d (diff)
downloadpodman-9853b147199b270271f2fa68fdef68bc4027ed33.tar.gz
podman-9853b147199b270271f2fa68fdef68bc4027ed33.tar.bz2
podman-9853b147199b270271f2fa68fdef68bc4027ed33.zip
Merge pull request #11151 from containers/dependabot/go_modules/github.com/onsi/gomega-1.15.0
Bump github.com/onsi/gomega from 1.14.0 to 1.15.0
Diffstat (limited to 'vendor/github.com/onsi/gomega/internal/gomega.go')
-rw-r--r--vendor/github.com/onsi/gomega/internal/gomega.go102
1 files changed, 102 insertions, 0 deletions
diff --git a/vendor/github.com/onsi/gomega/internal/gomega.go b/vendor/github.com/onsi/gomega/internal/gomega.go
new file mode 100644
index 000000000..f5b5c6b7a
--- /dev/null
+++ b/vendor/github.com/onsi/gomega/internal/gomega.go
@@ -0,0 +1,102 @@
+package internal
+
+import (
+ "time"
+
+ "github.com/onsi/gomega/types"
+)
+
+type Gomega struct {
+ Fail types.GomegaFailHandler
+ THelper func()
+ DurationBundle DurationBundle
+}
+
+func NewGomega(bundle DurationBundle) *Gomega {
+ return &Gomega{
+ Fail: nil,
+ THelper: nil,
+ DurationBundle: bundle,
+ }
+}
+
+func (g *Gomega) IsConfigured() bool {
+ return g.Fail != nil && g.THelper != nil
+}
+
+func (g *Gomega) ConfigureWithFailHandler(fail types.GomegaFailHandler) *Gomega {
+ g.Fail = fail
+ g.THelper = func() {}
+ return g
+}
+
+func (g *Gomega) ConfigureWithT(t types.GomegaTestingT) *Gomega {
+ g.Fail = func(message string, _ ...int) {
+ t.Helper()
+ t.Fatalf("\n%s", message)
+ }
+ g.THelper = t.Helper
+ return g
+}
+
+func (g *Gomega) Ω(atual interface{}, extra ...interface{}) types.Assertion {
+ return g.ExpectWithOffset(0, atual, extra...)
+}
+
+func (g *Gomega) Expect(atual interface{}, extra ...interface{}) types.Assertion {
+ return g.ExpectWithOffset(0, atual, extra...)
+}
+
+func (g *Gomega) ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) types.Assertion {
+ return NewAssertion(actual, g, offset, extra...)
+}
+
+func (g *Gomega) Eventually(actual interface{}, intervals ...interface{}) types.AsyncAssertion {
+ return g.EventuallyWithOffset(0, actual, intervals...)
+}
+
+func (g *Gomega) EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) types.AsyncAssertion {
+ timeoutInterval := g.DurationBundle.EventuallyTimeout
+ pollingInterval := g.DurationBundle.EventuallyPollingInterval
+ if len(intervals) > 0 {
+ timeoutInterval = toDuration(intervals[0])
+ }
+ if len(intervals) > 1 {
+ pollingInterval = toDuration(intervals[1])
+ }
+
+ return NewAsyncAssertion(AsyncAssertionTypeEventually, actual, g, timeoutInterval, pollingInterval, offset)
+}
+
+func (g *Gomega) Consistently(actual interface{}, intervals ...interface{}) types.AsyncAssertion {
+ return g.ConsistentlyWithOffset(0, actual, intervals...)
+}
+
+func (g *Gomega) ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) types.AsyncAssertion {
+ timeoutInterval := g.DurationBundle.ConsistentlyDuration
+ pollingInterval := g.DurationBundle.ConsistentlyPollingInterval
+ if len(intervals) > 0 {
+ timeoutInterval = toDuration(intervals[0])
+ }
+ if len(intervals) > 1 {
+ pollingInterval = toDuration(intervals[1])
+ }
+
+ return NewAsyncAssertion(AsyncAssertionTypeConsistently, actual, g, timeoutInterval, pollingInterval, offset)
+}
+
+func (g *Gomega) SetDefaultEventuallyTimeout(t time.Duration) {
+ g.DurationBundle.EventuallyTimeout = t
+}
+
+func (g *Gomega) SetDefaultEventuallyPollingInterval(t time.Duration) {
+ g.DurationBundle.EventuallyPollingInterval = t
+}
+
+func (g *Gomega) SetDefaultConsistentlyDuration(t time.Duration) {
+ g.DurationBundle.ConsistentlyDuration = t
+}
+
+func (g *Gomega) SetDefaultConsistentlyPollingInterval(t time.Duration) {
+ g.DurationBundle.ConsistentlyPollingInterval = t
+}