Skip to content

Commit 0b535c7

Browse files
committed
vendor: gotest.tools/v3 v3.5.0
- go.mod: update dependencies and go version by - Use Go1.20 - Fix couple of typos - Added `WithStdout` and `WithStderr` helpers - Moved `cmdOperators` handling from `RunCmd` to `StartCmd` - Deprecate `assert.ErrorType` - Remove outdated Dockerfile - add godoc links full diff: gotestyourself/gotest.tools@v3.4.0...v3.5.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent e0e2772 commit 0b535c7

12 files changed

Lines changed: 100 additions & 78 deletions

File tree

.golangci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ issues:
117117
- text: "package-comments: should have a package comment"
118118
linters:
119119
- revive
120-
120+
# FIXME temporarily suppress these (see https://github.com/gotestyourself/gotest.tools/issues/272)
121+
- text: "SA1019: (assert|cmp|is)\\.ErrorType is deprecated"
122+
linters:
123+
- staticcheck
121124
# Exclude some linters from running on tests files.
122125
- path: _test\.go
123126
linters:

vendor.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ require (
4343
golang.org/x/term v0.8.0
4444
golang.org/x/text v0.9.0
4545
gopkg.in/yaml.v2 v2.4.0
46-
gotest.tools/v3 v3.4.0
46+
gotest.tools/v3 v3.5.0
4747
)
4848

4949
require (

vendor.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7w
302302
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
303303
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
304304
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
305-
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
306305
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
307306
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
308307
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -323,7 +322,6 @@ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGm
323322
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
324323
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
325324
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
326-
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
327325
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
328326
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
329327
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -361,6 +359,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
361359
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
362360
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
363361
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
364-
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
365-
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
362+
gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY=
363+
gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
366364
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=

vendor/gotest.tools/v3/assert/assert.go

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ values in tests. When an assertion fails a helpful error message is printed.
44
55
# Example usage
66
7-
All the assertions in this package use testing.T.Helper to mark themselves as
7+
All the assertions in this package use [testing.T.Helper] to mark themselves as
88
test helpers. This allows the testing package to print the filename and line
99
number of the file function that failed.
1010
@@ -67,19 +67,19 @@ message is omitted from these examples for brevity.
6767
6868
# Assert and Check
6969
70-
Assert and Check are very similar, they both accept a Comparison, and fail
70+
[Assert] and [Check] are very similar, they both accept a [cmp.Comparison], and fail
7171
the test when the comparison fails. The one difference is that Assert uses
72-
testing.T.FailNow to fail the test, which will end the test execution immediately.
73-
Check uses testing.T.Fail to fail the test, which allows it to return the
72+
[testing.T.FailNow] to fail the test, which will end the test execution immediately.
73+
Check uses [testing.T.Fail] to fail the test, which allows it to return the
7474
result of the comparison, then proceed with the rest of the test case.
7575
76-
Like testing.T.FailNow, Assert must be called from the goroutine running the test,
77-
not from other goroutines created during the test. Check is safe to use from any
76+
Like [testing.T.FailNow], [Assert] must be called from the goroutine running the test,
77+
not from other goroutines created during the test. [Check] is safe to use from any
7878
goroutine.
7979
8080
# Comparisons
8181
82-
Package http://pkg.go.dev/gotest.tools/v3/assert/cmp provides
82+
Package [gotest.tools/v3/assert/cmp] provides
8383
many common comparisons. Additional comparisons can be written to compare
8484
values in other ways. See the example Assert (CustomComparison).
8585
@@ -98,11 +98,11 @@ import (
9898
"gotest.tools/v3/internal/assert"
9999
)
100100

101-
// BoolOrComparison can be a bool, cmp.Comparison, or error. See Assert for
101+
// BoolOrComparison can be a bool, [cmp.Comparison], or error. See [Assert] for
102102
// details about how this type is used.
103103
type BoolOrComparison interface{}
104104

105-
// TestingT is the subset of testing.T used by the assert package.
105+
// TestingT is the subset of [testing.T] (see also [testing.TB]) used by the assert package.
106106
type TestingT interface {
107107
FailNow()
108108
Fail()
@@ -133,11 +133,11 @@ type helperT interface {
133133
//
134134
// Extra details can be added to the failure message using msgAndArgs. msgAndArgs
135135
// may be either a single string, or a format string and args that will be
136-
// passed to fmt.Sprintf.
136+
// passed to [fmt.Sprintf].
137137
//
138-
// Assert uses t.FailNow to fail the test. Like t.FailNow, Assert must be called
138+
// Assert uses [testing.TB.FailNow] to fail the test. Like t.FailNow, Assert must be called
139139
// from the goroutine running the test function, not from other
140-
// goroutines created during the test. Use Check from other goroutines.
140+
// goroutines created during the test. Use [Check] from other goroutines.
141141
func Assert(t TestingT, comparison BoolOrComparison, msgAndArgs ...interface{}) {
142142
if ht, ok := t.(helperT); ok {
143143
ht.Helper()
@@ -151,7 +151,7 @@ func Assert(t TestingT, comparison BoolOrComparison, msgAndArgs ...interface{})
151151
// failed, a failure message is printed, and Check returns false. If the comparison
152152
// is successful Check returns true. Check may be called from any goroutine.
153153
//
154-
// See Assert for details about the comparison arg and failure messages.
154+
// See [Assert] for details about the comparison arg and failure messages.
155155
func Check(t TestingT, comparison BoolOrComparison, msgAndArgs ...interface{}) bool {
156156
if ht, ok := t.(helperT); ok {
157157
ht.Helper()
@@ -166,9 +166,9 @@ func Check(t TestingT, comparison BoolOrComparison, msgAndArgs ...interface{}) b
166166
// NilError fails the test immediately if err is not nil, and includes err.Error
167167
// in the failure message.
168168
//
169-
// NilError uses t.FailNow to fail the test. Like t.FailNow, NilError must be
169+
// NilError uses [testing.TB.FailNow] to fail the test. Like t.FailNow, NilError must be
170170
// called from the goroutine running the test function, not from other
171-
// goroutines created during the test. Use Check from other goroutines.
171+
// goroutines created during the test. Use [Check] from other goroutines.
172172
func NilError(t TestingT, err error, msgAndArgs ...interface{}) {
173173
if ht, ok := t.(helperT); ok {
174174
ht.Helper()
@@ -193,9 +193,9 @@ func NilError(t TestingT, err error, msgAndArgs ...interface{}) {
193193
// the unified diff will be augmented by replacing whitespace characters with
194194
// visible characters to identify the whitespace difference.
195195
//
196-
// Equal uses t.FailNow to fail the test. Like t.FailNow, Equal must be
196+
// Equal uses [testing.T.FailNow] to fail the test. Like t.FailNow, Equal must be
197197
// called from the goroutine running the test function, not from other
198-
// goroutines created during the test. Use Check with cmp.Equal from other
198+
// goroutines created during the test. Use [Check] with [cmp.Equal] from other
199199
// goroutines.
200200
func Equal(t TestingT, x, y interface{}, msgAndArgs ...interface{}) {
201201
if ht, ok := t.(helperT); ok {
@@ -206,15 +206,15 @@ func Equal(t TestingT, x, y interface{}, msgAndArgs ...interface{}) {
206206
}
207207
}
208208

209-
// DeepEqual uses google/go-cmp (https://godoc.org/github.com/google/go-cmp/cmp)
209+
// DeepEqual uses [github.com/google/go-cmp/cmp]
210210
// to assert two values are equal and fails the test if they are not equal.
211211
//
212-
// Package http://pkg.go.dev/gotest.tools/v3/assert/opt provides some additional
212+
// Package [gotest.tools/v3/assert/opt] provides some additional
213213
// commonly used Options.
214214
//
215-
// DeepEqual uses t.FailNow to fail the test. Like t.FailNow, DeepEqual must be
215+
// DeepEqual uses [testing.T.FailNow] to fail the test. Like t.FailNow, DeepEqual must be
216216
// called from the goroutine running the test function, not from other
217-
// goroutines created during the test. Use Check with cmp.DeepEqual from other
217+
// goroutines created during the test. Use [Check] with [cmp.DeepEqual] from other
218218
// goroutines.
219219
func DeepEqual(t TestingT, x, y interface{}, opts ...gocmp.Option) {
220220
if ht, ok := t.(helperT); ok {
@@ -227,13 +227,13 @@ func DeepEqual(t TestingT, x, y interface{}, opts ...gocmp.Option) {
227227

228228
// Error fails the test if err is nil, or if err.Error is not equal to expected.
229229
// Both err.Error and expected will be included in the failure message.
230-
// Error performs an exact match of the error text. Use ErrorContains if only
231-
// part of the error message is relevant. Use ErrorType or ErrorIs to compare
230+
// Error performs an exact match of the error text. Use [ErrorContains] if only
231+
// part of the error message is relevant. Use [ErrorType] or [ErrorIs] to compare
232232
// errors by type.
233233
//
234-
// Error uses t.FailNow to fail the test. Like t.FailNow, Error must be
234+
// Error uses [testing.T.FailNow] to fail the test. Like t.FailNow, Error must be
235235
// called from the goroutine running the test function, not from other
236-
// goroutines created during the test. Use Check with cmp.Error from other
236+
// goroutines created during the test. Use [Check] with [cmp.Error] from other
237237
// goroutines.
238238
func Error(t TestingT, err error, expected string, msgAndArgs ...interface{}) {
239239
if ht, ok := t.(helperT); ok {
@@ -248,9 +248,9 @@ func Error(t TestingT, err error, expected string, msgAndArgs ...interface{}) {
248248
// contain the expected substring. Both err.Error and the expected substring
249249
// will be included in the failure message.
250250
//
251-
// ErrorContains uses t.FailNow to fail the test. Like t.FailNow, ErrorContains
251+
// ErrorContains uses [testing.T.FailNow] to fail the test. Like t.FailNow, ErrorContains
252252
// must be called from the goroutine running the test function, not from other
253-
// goroutines created during the test. Use Check with cmp.ErrorContains from other
253+
// goroutines created during the test. Use [Check] with [cmp.ErrorContains] from other
254254
// goroutines.
255255
func ErrorContains(t TestingT, err error, substring string, msgAndArgs ...interface{}) {
256256
if ht, ok := t.(helperT); ok {
@@ -262,8 +262,7 @@ func ErrorContains(t TestingT, err error, substring string, msgAndArgs ...interf
262262
}
263263

264264
// ErrorType fails the test if err is nil, or err is not the expected type.
265-
// Most new code should use ErrorIs instead. ErrorType may be deprecated in the
266-
// future.
265+
// New code should use ErrorIs instead.
267266
//
268267
// Expected can be one of:
269268
//
@@ -281,10 +280,12 @@ func ErrorContains(t TestingT, err error, substring string, msgAndArgs ...interf
281280
// reflect.Type
282281
// The assertion fails if err does not implement the reflect.Type.
283282
//
284-
// ErrorType uses t.FailNow to fail the test. Like t.FailNow, ErrorType
283+
// ErrorType uses [testing.T.FailNow] to fail the test. Like t.FailNow, ErrorType
285284
// must be called from the goroutine running the test function, not from other
286-
// goroutines created during the test. Use Check with cmp.ErrorType from other
285+
// goroutines created during the test. Use [Check] with [cmp.ErrorType] from other
287286
// goroutines.
287+
//
288+
// Deprecated: Use [ErrorIs]
288289
func ErrorType(t TestingT, err error, expected interface{}, msgAndArgs ...interface{}) {
289290
if ht, ok := t.(helperT); ok {
290291
ht.Helper()
@@ -295,12 +296,12 @@ func ErrorType(t TestingT, err error, expected interface{}, msgAndArgs ...interf
295296
}
296297

297298
// ErrorIs fails the test if err is nil, or the error does not match expected
298-
// when compared using errors.Is. See https://golang.org/pkg/errors/#Is for
299+
// when compared using errors.Is. See [errors.Is] for
299300
// accepted arguments.
300301
//
301-
// ErrorIs uses t.FailNow to fail the test. Like t.FailNow, ErrorIs
302+
// ErrorIs uses [testing.T.FailNow] to fail the test. Like t.FailNow, ErrorIs
302303
// must be called from the goroutine running the test function, not from other
303-
// goroutines created during the test. Use Check with cmp.ErrorIs from other
304+
// goroutines created during the test. Use [Check] with [cmp.ErrorIs] from other
304305
// goroutines.
305306
func ErrorIs(t TestingT, err error, expected error, msgAndArgs ...interface{}) {
306307
if ht, ok := t.(helperT); ok {

vendor/gotest.tools/v3/assert/cmp/compare.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ import (
1212
"gotest.tools/v3/internal/format"
1313
)
1414

15-
// Comparison is a function which compares values and returns ResultSuccess if
15+
// Comparison is a function which compares values and returns [ResultSuccess] if
1616
// the actual value matches the expected value. If the values do not match the
17-
// Result will contain a message about why it failed.
17+
// [Result] will contain a message about why it failed.
1818
type Comparison func() Result
1919

20-
// DeepEqual compares two values using google/go-cmp
21-
// (https://godoc.org/github.com/google/go-cmp/cmp)
20+
// DeepEqual compares two values using [github.com/google/go-cmp/cmp]
2221
// and succeeds if the values are equal.
2322
//
2423
// The comparison can be customized using comparison Options.
25-
// Package http://pkg.go.dev/gotest.tools/v3/assert/opt provides some additional
24+
// Package [gotest.tools/v3/assert/opt] provides some additional
2625
// commonly used Options.
2726
func DeepEqual(x, y interface{}, opts ...cmp.Option) Comparison {
2827
return func() (result Result) {
@@ -61,7 +60,7 @@ func toResult(success bool, msg string) Result {
6160
return ResultFailure(msg)
6261
}
6362

64-
// RegexOrPattern may be either a *regexp.Regexp or a string that is a valid
63+
// RegexOrPattern may be either a [*regexp.Regexp] or a string that is a valid
6564
// regexp pattern.
6665
type RegexOrPattern interface{}
6766

@@ -95,7 +94,7 @@ func Regexp(re RegexOrPattern, v string) Comparison {
9594
}
9695
}
9796

98-
// Equal succeeds if x == y. See assert.Equal for full documentation.
97+
// Equal succeeds if x == y. See [gotest.tools/v3/assert.Equal] for full documentation.
9998
func Equal(x, y interface{}) Comparison {
10099
return func() Result {
101100
switch {
@@ -159,10 +158,10 @@ func Len(seq interface{}, expected int) Comparison {
159158
// slice, or array.
160159
//
161160
// If collection is a string, item must also be a string, and is compared using
162-
// strings.Contains().
161+
// [strings.Contains].
163162
// If collection is a Map, contains will succeed if item is a key in the map.
164163
// If collection is a slice or array, item is compared to each item in the
165-
// sequence using reflect.DeepEqual().
164+
// sequence using [reflect.DeepEqual].
166165
func Contains(collection interface{}, item interface{}) Comparison {
167166
return func() Result {
168167
colValue := reflect.ValueOf(collection)
@@ -259,7 +258,7 @@ func formatErrorMessage(err error) string {
259258

260259
// Nil succeeds if obj is a nil interface, pointer, or function.
261260
//
262-
// Use NilError() for comparing errors. Use Len(obj, 0) for comparing slices,
261+
// Use [gotest.tools/v3/assert.NilError] for comparing errors. Use Len(obj, 0) for comparing slices,
263262
// maps, and channels.
264263
func Nil(obj interface{}) Comparison {
265264
msgFunc := func(value reflect.Value) string {
@@ -306,7 +305,9 @@ func isNil(obj interface{}, msgFunc func(reflect.Value) string) Comparison {
306305
//
307306
// reflect.Type
308307
//
309-
// Fails if err does not implement the reflect.Type
308+
// Fails if err does not implement the [reflect.Type].
309+
//
310+
// Deprecated: Use [ErrorIs]
310311
func ErrorType(err error, expected interface{}) Comparison {
311312
return func() Result {
312313
switch expectedType := expected.(type) {
@@ -381,7 +382,7 @@ var (
381382
)
382383

383384
// ErrorIs succeeds if errors.Is(actual, expected) returns true. See
384-
// https://golang.org/pkg/errors/#Is for accepted argument values.
385+
// [errors.Is] for accepted argument values.
385386
func ErrorIs(actual error, expected error) Comparison {
386387
return func() Result {
387388
if errors.Is(actual, expected) {

vendor/gotest.tools/v3/assert/cmp/result.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"gotest.tools/v3/internal/source"
1111
)
1212

13-
// A Result of a Comparison.
13+
// A Result of a [Comparison].
1414
type Result interface {
1515
Success() bool
1616
}
1717

18-
// StringResult is an implementation of Result that reports the error message
18+
// StringResult is an implementation of [Result] that reports the error message
1919
// string verbatim and does not provide any templating or formatting of the
2020
// message.
2121
type StringResult struct {
@@ -34,16 +34,16 @@ func (r StringResult) FailureMessage() string {
3434
return r.message
3535
}
3636

37-
// ResultSuccess is a constant which is returned by a ComparisonWithResult to
37+
// ResultSuccess is a constant which is returned by a [Comparison] to
3838
// indicate success.
3939
var ResultSuccess = StringResult{success: true}
4040

41-
// ResultFailure returns a failed Result with a failure message.
41+
// ResultFailure returns a failed [Result] with a failure message.
4242
func ResultFailure(message string) StringResult {
4343
return StringResult{message: message}
4444
}
4545

46-
// ResultFromError returns ResultSuccess if err is nil. Otherwise ResultFailure
46+
// ResultFromError returns [ResultSuccess] if err is nil. Otherwise [ResultFailure]
4747
// is returned with the error message as the failure message.
4848
func ResultFromError(err error) Result {
4949
if err == nil {
@@ -74,7 +74,7 @@ func (r templatedResult) UpdatedExpected(stackIndex int) error {
7474
return source.UpdateExpectedValue(stackIndex+1, r.data["x"], r.data["y"])
7575
}
7676

77-
// ResultFailureTemplate returns a Result with a template string and data which
77+
// ResultFailureTemplate returns a [Result] with a template string and data which
7878
// can be used to format a failure message. The template may access data from .Data,
7979
// the comparison args with the callArg function, and the formatNode function may
8080
// be used to format the call args.

vendor/gotest.tools/v3/env/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func PatchAll(t assert.TestingT, env map[string]string) func() {
7272
return clean
7373
}
7474

75-
// ToMap takes a list of strings in the format returned by os.Environ() and
75+
// ToMap takes a list of strings in the format returned by [os.Environ] and
7676
// returns a mapping of keys to values.
7777
func ToMap(env []string) map[string]string {
7878
result := map[string]string{}

0 commit comments

Comments
 (0)