/
tests_suite.go
316 lines (217 loc) · 8.11 KB
/
tests_suite.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
package tests
import (
"errors"
"fmt"
"path"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
gomegaTypes "github.com/onsi/gomega/types"
)
// Done is part of the Ginkgo DSL
type Done ginkgo.Done
// Benchmarker is part of the Ginkgo DSL
type Benchmarker ginkgo.Benchmarker
// GinkgoWriter is part of the Ginkgo DSL
var GinkgoWriter = ginkgo.GinkgoWriter
// GinkgoParallelNode is part of the Ginkgo DSL
var GinkgoParallelNode = ginkgo.GinkgoParallelNode
// GinkgoT is part of the Ginkgo DSL
var GinkgoT = ginkgo.GinkgoT
// CurrentGinkgoTestDescription is part of the Ginkgo DSL
var CurrentGinkgoTestDescription = ginkgo.CurrentGinkgoTestDescription
// RunSpecs is part of the Ginkgo DSL
var RunSpecs = ginkgo.RunSpecs
// RunSpecsWithDefaultAndCustomReporters is part of the Ginkgo DSL
var RunSpecsWithDefaultAndCustomReporters = ginkgo.RunSpecsWithDefaultAndCustomReporters
// RunSpecsWithCustomReporters is part of the Ginkgo DSL
var RunSpecsWithCustomReporters = ginkgo.RunSpecsWithCustomReporters
// Skip is part of the Ginkgo DSL
var Skip = ginkgo.Skip
// Fail is part of the Ginkgo DSL
var Fail = ginkgo.Fail
// GinkgoRecover is part of the Ginkgo DSL
var GinkgoRecover = ginkgo.GinkgoRecover
// Describe is part of the Ginkgo DSL
var Describe = ginkgo.Describe
// FDescribe is part of the Ginkgo DSL
var FDescribe = ginkgo.FDescribe
// PDescribe is part of the Ginkgo DSL
var PDescribe = ginkgo.PDescribe
// XDescribe is part of the Ginkgo DSL
var XDescribe = ginkgo.XDescribe
// Context is part of the Ginkgo DSL
var Context = ginkgo.Context
// FContext is part of the Ginkgo DSL
var FContext = ginkgo.FContext
// PContext is part of the Ginkgo DSL
var PContext = ginkgo.PContext
// XContext is part of the Ginkgo DSL
var XContext = ginkgo.XContext
// It is part of the Ginkgo DSL
var It = ginkgo.It
// FIt is part of the Ginkgo DSL
var FIt = ginkgo.FIt
// PIt is part of the Ginkgo DSL
var PIt = ginkgo.PIt
// XIt is part of the Ginkgo DSL
var XIt = ginkgo.XIt
// Specify is part of the Ginkgo DSL
var Specify = ginkgo.Specify
// FSpecify is part of the Ginkgo DSL
var FSpecify = ginkgo.FSpecify
// PSpecify is part of the Ginkgo DSL
var PSpecify = ginkgo.PSpecify
// XSpecify is part of the Ginkgo DSL
var XSpecify = ginkgo.XSpecify
// By is part of the Ginkgo DSL
var By = ginkgo.By
// Measure is part of the Ginkgo DSL
var Measure = ginkgo.Measure
// FMeasure is part of the Ginkgo DSL
var FMeasure = ginkgo.FMeasure
// PMeasure is part of the Ginkgo DSL
var PMeasure = ginkgo.PMeasure
// XMeasure is part of the Ginkgo DSL
var XMeasure = ginkgo.XMeasure
// BeforeSuite is part of the Ginkgo DSL
var BeforeSuite = ginkgo.BeforeSuite
// AfterSuite is part of the Ginkgo DSL
var AfterSuite = ginkgo.AfterSuite
// SynchronizedBeforeSuite is part of the Ginkgo DSL
var SynchronizedBeforeSuite = ginkgo.SynchronizedBeforeSuite
// SynchronizedAfterSuite is part of the Ginkgo DSL
var SynchronizedAfterSuite = ginkgo.SynchronizedAfterSuite
// BeforeEach is part of the Ginkgo DSL
var BeforeEach = ginkgo.BeforeEach
// JustBeforeEach is part of the Ginkgo DSL
var JustBeforeEach = ginkgo.JustBeforeEach
// AfterEach is part of the Ginkgo DSL
var AfterEach = ginkgo.AfterEach
// Declarations for Gomega DSL
// RegisterFailHandler is part of the Ginkgo DSL
var RegisterFailHandler = gomega.RegisterFailHandler
// RegisterTestingT is part of the Ginkgo DSL
var RegisterTestingT = gomega.RegisterTestingT
// InterceptGomegaFailures is part of the Ginkgo DSL
var InterceptGomegaFailures = gomega.InterceptGomegaFailures
// Ω is part of the Ginkgo DSL
var Ω = gomega.Ω
// Expect is part of the Ginkgo DSL
var Expect = gomega.Expect
// ExpectWithOffset is part of the Ginkgo DSL
var ExpectWithOffset = gomega.ExpectWithOffset
// Eventually is part of the Ginkgo DSL
var Eventually = gomega.Eventually
// EventuallyWithOffset is part of the Ginkgo DSL
var EventuallyWithOffset = gomega.EventuallyWithOffset
// Consistently is part of the Ginkgo DSL
var Consistently = gomega.Consistently
// ConsistentlyWithOffset is part of the Ginkgo DSL
var ConsistentlyWithOffset = gomega.ConsistentlyWithOffset
// SetDefaultEventuallyTimeout is part of the Ginkgo DSL
var SetDefaultEventuallyTimeout = gomega.SetDefaultEventuallyTimeout
// SetDefaultEventuallyPollingInterval is part of the Ginkgo DSL
var SetDefaultEventuallyPollingInterval = gomega.SetDefaultEventuallyPollingInterval
// SetDefaultConsistentlyDuration is part of the Ginkgo DSL
var SetDefaultConsistentlyDuration = gomega.SetDefaultConsistentlyDuration
// SetDefaultConsistentlyPollingInterval is part of the Ginkgo DSL
var SetDefaultConsistentlyPollingInterval = gomega.SetDefaultConsistentlyPollingInterval
// Declarations for Gomega Matchers
// Equal is part of the Ginkgo DSL
var Equal = gomega.Equal
// BeEquivalentTo is part of the Ginkgo DSL
var BeEquivalentTo = gomega.BeEquivalentTo
// BeIdenticalTo is part of the Ginkgo DSL
var BeIdenticalTo = gomega.BeIdenticalTo
// BeNil is part of the Ginkgo DSL
var BeNil = gomega.BeNil
// BeTrue is part of the Ginkgo DSL
var BeTrue = gomega.BeTrue
// BeFalse is part of the Ginkgo DSL
var BeFalse = gomega.BeFalse
// HaveOccurred is part of the Ginkgo DSL
var HaveOccurred = gomega.HaveOccurred
// Succeed is part of the Ginkgo DSL
var Succeed = gomega.Succeed
// MatchError is part of the Ginkgo DSL
var MatchError = gomega.MatchError
// BeClosed is part of the Ginkgo DSL
var BeClosed = gomega.BeClosed
// Receive is part of the Ginkgo DSL
var Receive = gomega.Receive
// BeSent is part of the Ginkgo DSL
var BeSent = gomega.BeSent
// MatchRegexp is part of the Ginkgo DSL
var MatchRegexp = gomega.MatchRegexp
// ContainSubstring is part of the Ginkgo DSL
var ContainSubstring = gomega.ContainSubstring
// HavePrefix is part of the Ginkgo DSL
var HavePrefix = gomega.HavePrefix
// HaveSuffix is part of the Ginkgo DSL
var HaveSuffix = gomega.HaveSuffix
// MatchJSON is part of the Ginkgo DSL
var MatchJSON = gomega.MatchJSON
// BeEmpty is part of the Ginkgo DSL
var BeEmpty = gomega.BeEmpty
// HaveLen is part of the Ginkgo DSL
var HaveLen = gomega.HaveLen
// HaveCap is part of the Ginkgo DSL
var HaveCap = gomega.HaveCap
// BeZero is part of the Ginkgo DSL
var BeZero = gomega.BeZero
// ContainElement is part of the Ginkgo DSL
var ContainElement = gomega.ContainElement
// ConsistOf is part of the Ginkgo DSL
var ConsistOf = gomega.ConsistOf
// HaveKey is part of the Ginkgo DSL
var HaveKey = gomega.HaveKey
// HaveKeyWithValue is part of the Ginkgo DSL
var HaveKeyWithValue = gomega.HaveKeyWithValue
// BeNumerically is part of the Ginkgo DSL
var BeNumerically = gomega.BeNumerically
// BeTemporally is part of the Ginkgo DSL
var BeTemporally = gomega.BeTemporally
// BeAssignableToTypeOf is part of the Ginkgo DSL
var BeAssignableToTypeOf = gomega.BeAssignableToTypeOf
// Panic is part of the Ginkgo DSL
var Panic = gomega.Panic
// BeAnExistingFile is part of the Ginkgo DSL
var BeAnExistingFile = gomega.BeAnExistingFile
// BeARegularFile is part of the Ginkgo DSL
var BeARegularFile = gomega.BeARegularFile
// BeADirectory is part of the Ginkgo DSL
var BeADirectory = gomega.BeADirectory
// And is part of the Ginkgo DSL
var And = gomega.And
// SatisfyAll is part of the Ginkgo DSL
var SatisfyAll = gomega.SatisfyAll
// Or is part of the Ginkgo DSL
var Or = gomega.Or
// SatisfyAny is part of the Ginkgo DSL
var SatisfyAny = gomega.SatisfyAny
// Not is part of the Ginkgo DSL
var Not = gomega.Not
// WithTransform is part of the Ginkgo DSL
var WithTransform = gomega.WithTransform
type pathMatcher struct {
expected string
}
func (pm *pathMatcher) Match(actual interface{}) (bool, error) {
szA, ok := actual.(string)
if !ok {
return false, errors.New("pathMatcher expects one or more strings")
}
return pm.expected == szA, nil
}
func (pm *pathMatcher) FailureMessage(actual interface{}) string {
return fmt.Sprintf(
"Expected\n\t%#v\nto be equal to\n\t%#v", actual, pm.expected)
}
func (pm *pathMatcher) NegatedFailureMessage(actual interface{}) string {
return fmt.Sprintf(
"Expected\n\t%#v\nnot to be equal to\n\t%#v", actual, pm.expected)
}
// Σ is a custom Ginkgo matcher.
func Σ(paths ...string) gomegaTypes.GomegaMatcher {
return &pathMatcher{path.Join(paths...)}
}